Source:
public void setup(OperatorContext context) { operatorContext = context; fileAccess.init(); timeBucketAssigner.setPurgeListener(this); timeBucketAssigner.setup(this); checkpointManager.setup(this); bucketsFileSystem.setup(this); if (buckets == null) { numBuckets = getNumBuckets(); buckets = new Bucket[numBuckets]; } for (Bucket bucket : buckets) { if (bucket != null) { bucket.setup(this); } } stateTracker.setup(this); long activationWindow = context.getValue(OperatorContext.ACTIVATION_WINDOW_ID); if (activationWindow != Stateless.WINDOW_ID) { try { long[] recoveredWindows = checkpointManager.getWindowIds(operatorContext.getId()); if (recoveredWindows == null) { readerService = Executors.newFixedThreadPool(numReaders, new NameableThreadFactory("managedStateReaders")); return; } for (long recoveredWindow : recoveredWindows) { if (recoveredWindow <= activationWindow) { @SuppressWarnings("unchecked") Map<Long, Map<Slice, Bucket.BucketedValue>> recoveredData = (Map<Long, Map<Slice, Bucket.BucketedValue>>) checkpointManager.load(operatorContext.getId(), recoveredWindow); if (recoveredData != null && !recoveredData.isEmpty()) { for (Map.Entry<Long, Map<Slice, Bucket.BucketedValue>> entry : recoveredData.entrySet()) { int bucketIdx = prepareBucket(entry.getKey()); buckets[bucketIdx].recoveredData(recoveredWindow, entry.getValue()); } } checkpointManager.save(recoveredData, operatorContext.getId(), recoveredWindow, true ); } else { checkpointManager.delete(operatorContext.getId(), recoveredWindow); } } } 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(); timeBucketAssigner.setPurgeListener(this); timeBucketAssigner.setup(this); checkpointManager.setup(this); bucketsFileSystem.setup(this); if (buckets == null) { numBuckets = getNumBuckets(); buckets = new Bucket[numBuckets]; } for (Bucket bucket : buckets) { if (bucket != null) { bucket.setup(this); } } stateTracker.setup(this); long activationWindow = context.getValue(OperatorContext.ACTIVATION_WINDOW_ID); if (activationWindow != Stateless.WINDOW_ID) { try { long[] recoveredWindows = checkpointManager.getWindowIds(operatorContext.getId()); if (recoveredWindows != null) { for (long recoveredWindow : recoveredWindows) { if (recoveredWindow <= activationWindow) { @SuppressWarnings("unchecked") Map<Long, Map<Slice, Bucket.BucketedValue>> recoveredData = (Map<Long, Map<Slice, Bucket.BucketedValue>>) checkpointManager.load(operatorContext.getId(), recoveredWindow); if (recoveredData != null && !recoveredData.isEmpty()) { for (Map.Entry<Long, Map<Slice, Bucket.BucketedValue>> entry : recoveredData.entrySet()) { int bucketIdx = prepareBucket(entry.getKey()); buckets[bucketIdx].recoveredData(recoveredWindow, entry.getValue()); } } checkpointManager.save(recoveredData, operatorContext.getId(), recoveredWindow, true ); } else { checkpointManager.delete(operatorContext.getId(), recoveredWindow); } } } } catch (IOException e) { throw new RuntimeException("recovering", e); } } readerService = Executors.newFixedThreadPool(numReaders, new NameableThreadFactory("managedStateReaders")); }