Source:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { work = deserialize(record.getData()); try { if (work.isCoalescing() && WorkStateHelper.getLastOffset(work.getId()) > context.getLastOffset()) { log.warn("Coalescing work id with new instance scheduled: " + work.getId() + ", skipping"); } else if (work.isIdempotent() && workIds.contains(work.getId())) { log.warn("Duplicate work id: " + work.getId() + " skipping"); } else { boolean storeState = Framework.getService(ConfigurationService.class) .isBooleanPropertyTrue(STORESTATE_KEY); if (storeState) { if (WorkStateHelper.getState(work.getId()) != Work.State.SCHEDULED) { log.warn("work has been canceled, saving and returning"); context.askForCheckpoint(); return; } WorkStateHelper.setState(work.getId(), Work.State.RUNNING, stateTTL); } new WorkHolder(work).run(); if (storeState) { Work.State state = WorkStateHelper.getLastOffset(work.getId()) > context.getLastOffset() ? Work.State.SCHEDULED : null; WorkStateHelper.setState(work.getId(), state, stateTTL); } workIds.add(work.getId()); } work.cleanUp(true, null); if (!work.isWorkInstanceSuspended()) { context.askForCheckpoint(); } } catch (Exception e) { if (ExceptionUtils.hasInterruptedCause(e)) { Thread.currentThread().interrupt(); log.warn( String.format("Work id: %s title: %s, has been interrupted, it will be rescheduled, record: %s", work.getId(), work.getTitle(), record)); } else { log.error(String.format("Work id: %s title: %s is in error, the work is skipped, record: %s", work.getId(), work.getTitle(), record)); context.askForCheckpoint(); } log.debug("Exception during work " + work.getId(), e); work.cleanUp(false, e); } finally { workTimer.update(work.getCompletionTime() - work.getStartTime(), TimeUnit.MILLISECONDS); work = null; } }

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { work = deserialize(record.getData()); try { if (work.isCoalescing() && WorkStateHelper.getLastOffset(work.getId()) > context.getLastOffset().offset()) { log.debug("Skipping duplicate of coalescing work id: " + work.getId()); } else if (work.isIdempotent() && workIds.contains(work.getId())) { log.debug("Skipping duplicate of idempotent work id: " + work.getId()); } else { boolean storeState = Framework.getService(ConfigurationService.class) .isBooleanPropertyTrue(STORESTATE_KEY); if (storeState) { if (WorkStateHelper.getState(work.getId()) != Work.State.SCHEDULED) { log.warn("work has been canceled, saving and returning"); context.askForCheckpoint(); return; } WorkStateHelper.setState(work.getId(), Work.State.RUNNING, stateTTL); } new WorkHolder(work).run(); if (storeState && WorkStateHelper.getState(work.getId()) == Work.State.RUNNING) { WorkStateHelper.setState(work.getId(), null, stateTTL); } workIds.add(work.getId()); } work.cleanUp(true, null); if (!work.isWorkInstanceSuspended()) { context.askForCheckpoint(); } } catch (Exception e) { if (ExceptionUtils.hasInterruptedCause(e)) { Thread.currentThread().interrupt(); log.warn( String.format("Work id: %s title: %s, has been interrupted, it will be rescheduled, record: %s", work.getId(), work.getTitle(), record)); } else { log.error(String.format("Work id: %s title: %s is in error, the work is skipped, record: %s", work.getId(), work.getTitle(), record)); context.askForCheckpoint(); } log.debug("Exception during work " + work.getId(), e); work.cleanUp(false, e); } finally { workTimer.update(work.getCompletionTime() - work.getStartTime(), TimeUnit.MILLISECONDS); work = null; } }