Source:
public void setup(OperatorContext context) { operatorContext = context; fileAccess.init(); if ( timeBucketAssigner == null ) { MovingBoundaryTimeBucketAssigner movingBoundaryTimeBucketAssigner = new MovingBoundaryTimeBucketAssigner(); movingBoundaryTimeBucketAssigner.setPurgeListener(this); setTimeBucketAssigner(movingBoundaryTimeBucketAssigner); } timeBucketAssigner.setPurgeListener(this); timeBucketAssigner.setup(this); checkpointManager.setup(this); bucketsFileSystem.setup(this); if (buckets == null) { numBuckets = getNumBuckets(); buckets = new HashMap<>(); } for (Bucket bucket : buckets.values()) { if (bucket != null) { bucket.setup(this); } } stateTracker.setup(this); long activationWindow = context.getValue(OperatorContext.ACTIVATION_WINDOW_ID); if (activationWindow != Stateless.WINDOW_ID) { try { Map<Long, Object> statePerWindow = checkpointManager.retrieveAllWindows(); for (Map.Entry<Long, Object> stateEntry : statePerWindow.entrySet()) { Preconditions.checkArgument(stateEntry.getKey() <= activationWindow, stateEntry.getKey() + " greater than " + activationWindow); @SuppressWarnings("unchecked") Map<Long, Map<Slice, Bucket.BucketedValue>> state = (Map<Long, Map<Slice, Bucket.BucketedValue>>) stateEntry.getValue(); if (state != null && !state.isEmpty()) { for (Map.Entry<Long, Map<Slice, Bucket.BucketedValue>> bucketEntry : state.entrySet()) { long bucketIdx = prepareBucket(bucketEntry.getKey()); buckets.get(bucketIdx).recoveredData(stateEntry.getKey(), bucketEntry.getValue()); } } checkpointManager.save(state, stateEntry.getKey(), true ); } } catch (IOException e) { throw new RuntimeException("recovering", e); } } readerService = Executors.newFixedThreadPool(numReaders, new NameableThreadFactory("managedStateReaders")); }

Target:
public void setup(OperatorContext context) { operatorContext = context; fileAccess.init(); if (timeBucketAssigner == null) { MovingBoundaryTimeBucketAssigner movingBoundaryTimeBucketAssigner = new MovingBoundaryTimeBucketAssigner(); setTimeBucketAssigner(movingBoundaryTimeBucketAssigner); } timeBucketAssigner.setPurgeListener(this); timeBucketAssigner.setup(this); checkpointManager.setup(this); bucketsFileSystem.setup(this); if (buckets == null) { numBuckets = getNumBuckets(); buckets = new HashMap<>(); } for (Bucket bucket : buckets.values()) { if (bucket != null) { bucket.setup(this); } } stateTracker.setup(this); long activationWindow = context.getValue(OperatorContext.ACTIVATION_WINDOW_ID); if (activationWindow != Stateless.WINDOW_ID) { try { Map<Long, Object> statePerWindow = checkpointManager.retrieveAllWindows(); for (Map.Entry<Long, Object> stateEntry : statePerWindow.entrySet()) { Preconditions.checkArgument(stateEntry.getKey() <= activationWindow, stateEntry.getKey() + " greater than " + activationWindow); @SuppressWarnings("unchecked") Map<Long, Map<Slice, Bucket.BucketedValue>> state = (Map<Long, Map<Slice, Bucket.BucketedValue>>) stateEntry.getValue(); if (state != null && !state.isEmpty()) { for (Map.Entry<Long, Map<Slice, Bucket.BucketedValue>> bucketEntry : state.entrySet()) { long bucketIdx = prepareBucket(bucketEntry.getKey()); buckets.get(bucketIdx).recoveredData(stateEntry.getKey(), bucketEntry.getValue()); } } checkpointManager.save(state, stateEntry.getKey(), true ); } } catch (IOException e) { throw new RuntimeException("recovering", e); } } readerService = Executors.newFixedThreadPool(numReaders, new NameableThreadFactory("managedStateReaders")); }