Search in sources :

Example 1 with DataGapFastDetector

use of org.jumpmind.symmetric.route.DataGapFastDetector in project symmetric-ds by JumpMind.

the class RouterService method routeData.

/**
     * This method will route data to specific nodes.
     */
public synchronized long routeData(boolean force) {
    long dataCount = -1l;
    Node identity = engine.getNodeService().findIdentity();
    if (identity != null) {
        if (force || engine.getClusterService().lock(ClusterConstants.ROUTE)) {
            try {
                if (firstTimeCheckForAbandonedBatches) {
                    engine.getOutgoingBatchService().updateAbandonedRoutingBatches();
                    firstTimeCheckForAbandonedBatches = false;
                }
                if (gapDetector == null) {
                    if (parameterService.is(ParameterConstants.ROUTING_USE_FAST_GAP_DETECTOR)) {
                        gapDetector = new DataGapFastDetector(engine.getDataService(), parameterService, engine.getContextService(), symmetricDialect, this, engine.getStatisticManager(), engine.getNodeService());
                    } else {
                        gapDetector = new DataGapDetector(engine.getDataService(), parameterService, symmetricDialect, this, engine.getStatisticManager(), engine.getNodeService());
                    }
                }
                insertInitialLoadEvents();
                long ts = System.currentTimeMillis();
                gapDetector.beforeRouting();
                dataCount = routeDataForEachChannel();
                ts = System.currentTimeMillis() - ts;
                if (dataCount > 0 || ts > Constants.LONG_OPERATION_THRESHOLD) {
                    log.info("Routed {} data events in {} ms", dataCount, ts);
                }
                if (dataCount > 0) {
                    gapDetector.afterRouting();
                }
            } finally {
                if (!force) {
                    engine.getClusterService().unlock(ClusterConstants.ROUTE);
                }
            }
        }
    }
    return dataCount;
}
Also used : DataGapFastDetector(org.jumpmind.symmetric.route.DataGapFastDetector) DataGapDetector(org.jumpmind.symmetric.route.DataGapDetector) Node(org.jumpmind.symmetric.model.Node)

Aggregations

Node (org.jumpmind.symmetric.model.Node)1 DataGapDetector (org.jumpmind.symmetric.route.DataGapDetector)1 DataGapFastDetector (org.jumpmind.symmetric.route.DataGapFastDetector)1