View Revisions: Issue #3857

Summary 0003857: NodeService.findNode(...) (cached versus non-cached), where to use correct one
Revision 2019-01-17 20:09 by pmarzullo
Description I looked at the calls to NodeService.findNode(...) (the non-cached versions, 40 of them) and summarized which ones can use the cached version.
My logic was, if it had anything to do with changing the node, or registering the node, or reloading the node, it should call the non-cached version, otherwise use the cached version.

Let me know what you think.

symmetric-client (project)
    org.jumpmind.symmetric.SymmetricAdmin (class)
        getNodes(CommandLine) (method)
            This method should call (non-cached) findNode(String id) because it is a one off call
    org.jumpmind.symmetric.service.jmx.NodeManagementService
        setSyncEnabledForNode(String nodeId, boolean syncEnabled)
            This method should call (non-cached) findNode(String id) because it is updating the node
symmetric-core
    org.jumpmind.symmetric.file.FileSyncZipDataWriter
        write(CsvData data)
            This method should call (cached) findNode(String id, boolean cache) because it is only
            using the node.getNodeGroupId() for determining if the file reload should be
            written to this node.
    org.jumpmind.symmetric.service.impl.DataExtractorService
        execute(NodeCommunication, RemoteNodeStatus)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractOnlyOutgoingBatch(String nodeId, long batchId, Writer writer)
            Should call (cached) findNode(String, boolean)
        SeleceFromTableSource
            init(Batch batch, List<SelectFromTableEvent> initialLoadEvents)
                Should call (cached) findNode(String, boolean)
        transferFromStaging(ExtractMode mode, BatchType batchType, OutgoingBatch batch, boolean isRetry, IStagedResource stagedResource, BufferedWriter writer, DataContext context, BigDecimal maxKBytesPerSec)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.DataService
        insertReloadEvent(TableReloadRequest request, boolean deleteAtClient)
            Should call (non-cached) findNode(String)
        reloadMissingForeignKeyRowsReverse(String sourceNodeId, Table table, CsvData data, boolean sendCorrectionToPeers)
            Should call (non-cached) findNode(String)
        reloadNode(String nodeId, boolean reverseLoad, String createBy)
            Should call (non-cached) findNode(String)
        reloadTable(String nodeId, String catalogName, String schemaName, String tableName, String overrideInitialLoadSelect)
            Should call (non-cached) findNode(String)
        sendSchema(String nodeId, String catalogName, String schemaName, String tableName, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendScript(String nodeId, String script, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendSQL(String nodeId, String catalogName, String schemaName, String tableName, String sql)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.NodeService
        findNode(String id, boolean useCache)
            Should call (non-cached) findNode(String)
        findOfflineNodes(long minutesOffline)
            Should call (cached) findNode(String, boolean)
        getExternalId(String nodeId)
            Should call (cached) findNode(String, boolean)
        checkRegistrationSuccessful(boolean registered, int maxNumberOfAttempts)
            Should call (non-cached) findNode(String)
        openRegistration(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
        processRegistration(Node nodePriorToRegistration, String remoteHost, String remoteAddress, boolean isRequestedRegistration)
            Should call (non-cached) findNode(String)
        reOpenRegistration(String nodeId, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
    org.jumpmind.symmetric.service.impl.RouterService
        insertInitialLoadEvents()
            Should call (non-cached) findNode(String)
        processTableRequestLoads(Node source, ProcessInfo processInfo, Map<String, List<TriggerRouter>> triggerRoutersByTargetNodeGroupId)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.util.DefaultNodeIdCreator
        generateNodeId(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
symmetric-pro
    com.jumpmind.symmetric.console.ui.common.resolve.MissingTableResolver
        buttonClick(ClickEvent event)
            Should call (cached) findNode(String, boolean)
    com.jumpmind.symmetric.console.ui.screen.manage.ProcessInfoPanel
        refresh(ISymmetricEngine engine)
            Should call (cached) findNode(String, boolean)
symmetric-server
    org.jumpmind.symmetric.web.PullUriHandler
        handlePull(String nodeId, String remoteHost, String remoteAddress, OutputStream outputStream, String encoding, HttpServletResponse res, ChannelMap map)
            Should call (non-cached) findNode(String, boolean) (registering node)
    org.jumpmind.symmetric.web.rest.RestService
        getPullData(...)
            Should call (cached) findNode(String, boolean)
        securityVerified(String nodeId, ISymmetricEngine engine, String securityToken)
            Should call (non-cached) findNode(String, boolean) (uses non-cached version of findNodeSecurity(...))
        sendSchemaImpl(ISymmetricEngine engine, SendSchemaRequest request)
            Should call (non-cached) findNode(String, boolean)
Revision 2019-01-17 20:43 by pmarzullo
Description I looked at the calls to NodeService.findNode(...) (the non-cached versions, 40 of them) and summarized which ones can use the cached version.
My logic was, if it had anything to do with changing the node, or registering the node, or reloading the node, it should call the non-cached version, otherwise use the cached version.

Let me know what you think.

symmetric-client (project)
    org.jumpmind.symmetric.SymmetricAdmin (class)
        getNodes(CommandLine) (method)
            This method should call (non-cached) findNode(String id) because it is a one off call
    org.jumpmind.symmetric.service.jmx.NodeManagementService
        setSyncEnabledForNode(String nodeId, boolean syncEnabled)
            This method should call (non-cached) findNode(String id) because it is updating the node
symmetric-core
    org.jumpmind.symmetric.file.FileSyncZipDataWriter
        write(CsvData data)
            This method should call (cached) findNode(String id, boolean cache) because it is only
            using the node.getNodeGroupId() for determining if the file reload should be
            written to this node.
    org.jumpmind.symmetric.service.impl.DataExtractorService
        execute(NodeCommunication, RemoteNodeStatus)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractOnlyOutgoingBatch(String nodeId, long batchId, Writer writer)
            Should call (cached) findNode(String, boolean)
        SeleceFromTableSource
            init(Batch batch, List<SelectFromTableEvent> initialLoadEvents)
                Should call (cached) findNode(String, boolean)
        transferFromStaging(ExtractMode mode, BatchType batchType, OutgoingBatch batch, boolean isRetry, IStagedResource stagedResource, BufferedWriter writer, DataContext context, BigDecimal maxKBytesPerSec)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.DataService
        insertReloadEvent(TableReloadRequest request, boolean deleteAtClient)
            Should call (non-cached) findNode(String)
        reloadMissingForeignKeyRowsReverse(String sourceNodeId, Table table, CsvData data, boolean sendCorrectionToPeers)
            Should call (non-cached) findNode(String)
        reloadNode(String nodeId, boolean reverseLoad, String createBy)
            Should call (non-cached) findNode(String)
        reloadTable(String nodeId, String catalogName, String schemaName, String tableName, String overrideInitialLoadSelect)
            Should call (non-cached) findNode(String)
        sendSchema(String nodeId, String catalogName, String schemaName, String tableName, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendScript(String nodeId, String script, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendSQL(String nodeId, String catalogName, String schemaName, String tableName, String sql)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.NodeService
        findNode(String id, boolean useCache)
            Should call (non-cached) findNode(String)
        findOfflineNodes(long minutesOffline)
            Should call (cached) findNode(String, boolean)
        getExternalId(String nodeId)
            Should call (cached) findNode(String, boolean)
        org.jumpmind.symmetric.service.impl.RegistrationService
        checkRegistrationSuccessful(boolean registered, int maxNumberOfAttempts)
            Should call (non-cached) findNode(String)
        openRegistration(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
        processRegistration(Node nodePriorToRegistration, String remoteHost, String remoteAddress, boolean isRequestedRegistration)
            Should call (non-cached) findNode(String)
        reOpenRegistration(String nodeId, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
    org.jumpmind.symmetric.service.impl.RouterService
        insertInitialLoadEvents()
            Should call (non-cached) findNode(String)
        processTableRequestLoads(Node source, ProcessInfo processInfo, Map<String, List<TriggerRouter>> triggerRoutersByTargetNodeGroupId)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.util.DefaultNodeIdCreator
        generateNodeId(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
symmetric-pro
    com.jumpmind.symmetric.console.ui.common.resolve.MissingTableResolver
        buttonClick(ClickEvent event)
            Should call (cached) findNode(String, boolean)
    com.jumpmind.symmetric.console.ui.screen.manage.ProcessInfoPanel
        refresh(ISymmetricEngine engine)
            Should call (cached) findNode(String, boolean)
symmetric-server
    org.jumpmind.symmetric.web.PullUriHandler
        handlePull(String nodeId, String remoteHost, String remoteAddress, OutputStream outputStream, String encoding, HttpServletResponse res, ChannelMap map)
            Should call (non-cached) findNode(String, boolean) (registering node)
    org.jumpmind.symmetric.web.rest.RestService
        getPullData(...)
            Should call (cached) findNode(String, boolean)
        securityVerified(String nodeId, ISymmetricEngine engine, String securityToken)
            Should call (non-cached) findNode(String, boolean) (uses non-cached version of findNodeSecurity(...))
        sendSchemaImpl(ISymmetricEngine engine, SendSchemaRequest request)
            Should call (non-cached) findNode(String, boolean)
Revision 2019-01-17 20:43 by pmarzullo
Description I looked at the calls to NodeService.findNode(...) (the non-cached versions, 40 of them) and summarized which ones can use the cached version.
My logic was, if it had anything to do with changing the node, or registering the node, or reloading the node, it should call the non-cached version, otherwise use the cached version.

Let me know what you think.

symmetric-client (project)
    org.jumpmind.symmetric.SymmetricAdmin (class)
        getNodes(CommandLine) (method)
            This method should call (non-cached) findNode(String id) because it is a one off call
    org.jumpmind.symmetric.service.jmx.NodeManagementService
        setSyncEnabledForNode(String nodeId, boolean syncEnabled)
            This method should call (non-cached) findNode(String id) because it is updating the node
symmetric-core
    org.jumpmind.symmetric.file.FileSyncZipDataWriter
        write(CsvData data)
            This method should call (cached) findNode(String id, boolean cache) because it is only
            using the node.getNodeGroupId() for determining if the file reload should be
            written to this node.
    org.jumpmind.symmetric.service.impl.DataExtractorService
        execute(NodeCommunication, RemoteNodeStatus)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractBatchRange(Writer writer, String nodeId, Date startBatchTime, Date endBatchTime, String... channelIds)
            Should call (cached) findNode(String, boolean)
        extractOnlyOutgoingBatch(String nodeId, long batchId, Writer writer)
            Should call (cached) findNode(String, boolean)
        SeleceFromTableSource
            init(Batch batch, List<SelectFromTableEvent> initialLoadEvents)
                Should call (cached) findNode(String, boolean)
        transferFromStaging(ExtractMode mode, BatchType batchType, OutgoingBatch batch, boolean isRetry, IStagedResource stagedResource, BufferedWriter writer, DataContext context, BigDecimal maxKBytesPerSec)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.DataService
        insertReloadEvent(TableReloadRequest request, boolean deleteAtClient)
            Should call (non-cached) findNode(String)
        reloadMissingForeignKeyRowsReverse(String sourceNodeId, Table table, CsvData data, boolean sendCorrectionToPeers)
            Should call (non-cached) findNode(String)
        reloadNode(String nodeId, boolean reverseLoad, String createBy)
            Should call (non-cached) findNode(String)
        reloadTable(String nodeId, String catalogName, String schemaName, String tableName, String overrideInitialLoadSelect)
            Should call (non-cached) findNode(String)
        sendSchema(String nodeId, String catalogName, String schemaName, String tableName, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendScript(String nodeId, String script, boolean isLoad)
            Should call (cached) findNode(String, boolean)
        sendSQL(String nodeId, String catalogName, String schemaName, String tableName, String sql)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.NodeService
        findNode(String id, boolean useCache)
            Should call (non-cached) findNode(String)
        findOfflineNodes(long minutesOffline)
            Should call (cached) findNode(String, boolean)
        getExternalId(String nodeId)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.service.impl.RegistrationService
        checkRegistrationSuccessful(boolean registered, int maxNumberOfAttempts)
            Should call (non-cached) findNode(String)
        openRegistration(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
        processRegistration(Node nodePriorToRegistration, String remoteHost, String remoteAddress, boolean isRequestedRegistration)
            Should call (non-cached) findNode(String)
        reOpenRegistration(String nodeId, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
    org.jumpmind.symmetric.service.impl.RouterService
        insertInitialLoadEvents()
            Should call (non-cached) findNode(String)
        processTableRequestLoads(Node source, ProcessInfo processInfo, Map<String, List<TriggerRouter>> triggerRoutersByTargetNodeGroupId)
            Should call (cached) findNode(String, boolean)
    org.jumpmind.symmetric.util.DefaultNodeIdCreator
        generateNodeId(Node node, String remoteHost, String remoteAddress)
            Should call (non-cached) findNode(String)
symmetric-pro
    com.jumpmind.symmetric.console.ui.common.resolve.MissingTableResolver
        buttonClick(ClickEvent event)
            Should call (cached) findNode(String, boolean)
    com.jumpmind.symmetric.console.ui.screen.manage.ProcessInfoPanel
        refresh(ISymmetricEngine engine)
            Should call (cached) findNode(String, boolean)
symmetric-server
    org.jumpmind.symmetric.web.PullUriHandler
        handlePull(String nodeId, String remoteHost, String remoteAddress, OutputStream outputStream, String encoding, HttpServletResponse res, ChannelMap map)
            Should call (non-cached) findNode(String, boolean) (registering node)
    org.jumpmind.symmetric.web.rest.RestService
        getPullData(...)
            Should call (cached) findNode(String, boolean)
        securityVerified(String nodeId, ISymmetricEngine engine, String securityToken)
            Should call (non-cached) findNode(String, boolean) (uses non-cached version of findNodeSecurity(...))
        sendSchemaImpl(ISymmetricEngine engine, SendSchemaRequest request)
            Should call (non-cached) findNode(String, boolean)