/** * This method initializes all the resources necessary for the targeted sweeper. This method should only be called * once the kvs is ready. * @param timestamps supplier of unreadable and immutable timestamps. * @param timelockService TimeLockService to use for synchronizing iterations of sweep on different nodes * @param kvs key value service that must be already initialized. * @param transaction transaction service for checking if values were committed and rolling back if necessary * @param follower followers used for sweeps. */ public void initializeWithoutRunning( SpecialTimestampsSupplier timestamps, TimelockService timelockService, KeyValueService kvs, TransactionService transaction, TargetedSweepFollower follower) { if (isInitialized) { return; } Preconditions.checkState(kvs.isInitialized(), "Attempted to initialize targeted sweeper with an uninitialized backing KVS."); metrics = TargetedSweepMetrics.create(metricsManager, timelockService, kvs, SweepQueueUtils.REFRESH_TIME); queue = SweepQueue.create(metrics, kvs, timelockService, shardsConfig, transaction, follower); timestampsSupplier = timestamps; timeLock = timelockService; isInitialized = true; }
/** * This method initializes all the resources necessary for the targeted sweeper. This method should only be called * once the kvs is ready. * @param timestamps supplier of unreadable and immutable timestamps. * @param timelockService TimeLockService to use for synchronizing iterations of sweep on different nodes * @param kvs key value service that must be already initialized. * @param transaction transaction service for checking if values were committed and rolling back if necessary * @param follower followers used for sweeps. */ public void initializeWithoutRunning( SpecialTimestampsSupplier timestamps, TimelockService timelockService, KeyValueService kvs, TransactionService transaction, TargetedSweepFollower follower) { if (isInitialized) { return; } Preconditions.checkState(kvs.isInitialized(), "Attempted to initialize targeted sweeper with an uninitialized backing KVS."); metrics = TargetedSweepMetrics.create(metricsManager, timelockService, kvs, SweepQueueUtils.REFRESH_TIME); queue = SweepQueue.create(metrics, kvs, timelockService, shardsConfig, transaction, follower); timestampsSupplier = timestamps; timeLock = timelockService; isInitialized = true; }