Source:
void checkpoint(long windowId) { if (operator instanceof Operator.CheckpointNotificationListener) { ((Operator.CheckpointNotificationListener)operator).beforeCheckpoint(windowId); } if (!context.stateless) { StorageAgent ba = context.getValue(OperatorContext.STORAGE_AGENT); if (ba != null) { try { checkpointStats = new Stats.CheckpointStats(); checkpointStats.checkpointStartTime = System.currentTimeMillis(); ba.save(operator, id, windowId); if (ba instanceof AsyncFSStorageAgent) { AsyncFSStorageAgent asyncFSStorageAgent = (AsyncFSStorageAgent) ba; if (!asyncFSStorageAgent.isSyncCheckpoint()) { if(PROCESSING_MODE != ProcessingMode.EXACTLY_ONCE) { CheckpointWindowInfo checkpointWindowInfo = new CheckpointWindowInfo(); checkpointWindowInfo.windowId = windowId; checkpointWindowInfo.applicationWindowCount = applicationWindowCount; checkpointWindowInfo.checkpointWindowCount = checkpointWindowCount; CheckpointHandler checkpointHandler = new CheckpointHandler(); checkpointHandler.agent = asyncFSStorageAgent; checkpointHandler.operatorId = id; checkpointHandler.windowId = windowId; checkpointHandler.stats = checkpointStats; FutureTask<Stats.CheckpointStats> futureTask = new FutureTask<>(checkpointHandler); taskQueue.add(new Pair<FutureTask<Stats.CheckpointStats>, CheckpointWindowInfo>(futureTask, checkpointWindowInfo)); executorService.submit(futureTask); checkpoint = null; checkpointStats = null; return; }else{ asyncFSStorageAgent.copyToHDFS(id, windowId); } } } checkpointStats.checkpointTime = System.currentTimeMillis() - checkpointStats.checkpointStartTime; } catch (IOException ie) { try { logger.warn("Rolling back checkpoint for Operator due to the exception {}", Codec.getStringWindowId(windowId), operator, ie); ba.delete(id, windowId); } catch (IOException ex) { logger.warn("Error while rolling back checkpoint", ex); } throw new RuntimeException(ie); } } } checkpoint = new Checkpoint(windowId, applicationWindowCount, checkpointWindowCount); if (operator instanceof Operator.CheckpointListener) { ((Operator.CheckpointListener) operator).checkpointed(windowId); } }

Target:
void checkpoint(long windowId) { if (!context.stateless) { if (operator instanceof Operator.CheckpointNotificationListener) { ((Operator.CheckpointNotificationListener)operator).beforeCheckpoint(windowId); } StorageAgent ba = context.getValue(OperatorContext.STORAGE_AGENT); if (ba != null) { try { checkpointStats = new Stats.CheckpointStats(); checkpointStats.checkpointStartTime = System.currentTimeMillis(); ba.save(operator, id, windowId); if (ba instanceof AsyncFSStorageAgent) { AsyncFSStorageAgent asyncFSStorageAgent = (AsyncFSStorageAgent) ba; if (!asyncFSStorageAgent.isSyncCheckpoint()) { if(PROCESSING_MODE != ProcessingMode.EXACTLY_ONCE) { CheckpointWindowInfo checkpointWindowInfo = new CheckpointWindowInfo(); checkpointWindowInfo.windowId = windowId; checkpointWindowInfo.applicationWindowCount = applicationWindowCount; checkpointWindowInfo.checkpointWindowCount = checkpointWindowCount; CheckpointHandler checkpointHandler = new CheckpointHandler(); checkpointHandler.agent = asyncFSStorageAgent; checkpointHandler.operatorId = id; checkpointHandler.windowId = windowId; checkpointHandler.stats = checkpointStats; FutureTask<Stats.CheckpointStats> futureTask = new FutureTask<>(checkpointHandler); taskQueue.add(new Pair<FutureTask<Stats.CheckpointStats>, CheckpointWindowInfo>(futureTask, checkpointWindowInfo)); executorService.submit(futureTask); checkpoint = null; checkpointStats = null; return; }else{ asyncFSStorageAgent.copyToHDFS(id, windowId); } } } checkpointStats.checkpointTime = System.currentTimeMillis() - checkpointStats.checkpointStartTime; } catch (IOException ie) { try { logger.warn("Rolling back checkpoint for Operator due to the exception {}", Codec.getStringWindowId(windowId), operator, ie); ba.delete(id, windowId); } catch (IOException ex) { logger.warn("Error while rolling back checkpoint", ex); } throw new RuntimeException(ie); } } } checkpoint = new Checkpoint(windowId, applicationWindowCount, checkpointWindowCount); if (operator instanceof Operator.CheckpointListener) { ((Operator.CheckpointListener) operator).checkpointed(windowId); } }