Source:
private void jobCompleted(final JobCompleted<?> message) { _currentlyExecuting = false; if (!_cachedJob.isPresent()) { LOGGER.warn() .setMessage("uninitialized, but got completion message (perhaps from previous life?)") .addData("scheduled", message.getScheduled()) .addData("error", message.getError()) .log(); return; } final CachedJob<T> cachedJob = _cachedJob.get(); final JobRef<T> ref = cachedJob.getRef(); @SuppressWarnings("unchecked") final JobCompleted<T> typedMessage = (JobCompleted<T>) message; final JobRepository<T> repo = ref.getRepository(_injector); try { _periodicMetrics.recordCounter( "job_executor_actor_execution_successes", (message.getError() == null) ? 1 : 0); if (message.getError() == null) { if (typedMessage.getResult() == null) { throw new IllegalArgumentException(String.format("JobCompleted message for %s has null error *and* result", ref)); } LOGGER.debug() .setMessage("marking job as successful") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .log(); repo.jobSucceeded( ref.getJobId(), ref.getOrganization(), message.getScheduled(), typedMessage.getResult()); } else { LOGGER.debug() .setMessage("marking job as failed") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .addData("error", message.getError()) .log(); repo.jobFailed( ref.getJobId(), ref.getOrganization(), message.getScheduled(), typedMessage.getError()); } cachedJob.reload(_injector); } catch (final NoSuchJobException error) { LOGGER.warn() .setMessage("tried to job as complete, but job no longer exists in repository") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .log(); killSelf(); } }

Target:
private void jobCompleted(final JobCompleted<?> message) { _currentlyExecuting = false; if (!_cachedJob.isPresent()) { LOGGER.warn() .setMessage("uninitialized, but got completion message (perhaps from previous life?)") .addData("scheduled", message.getScheduled()) .addData("error", message.getError()) .log(); return; } final CachedJob<T> cachedJob = _cachedJob.get(); final JobRef<T> ref = cachedJob.getRef(); @SuppressWarnings("unchecked") final JobCompleted<T> typedMessage = (JobCompleted<T>) message; final JobRepository<T> repo = ref.getRepository(_injector); try { _periodicMetrics.recordCounter( "job_executor_actor_execution_successes", (message.getError() == null) ? 1 : 0); if (message.getError() == null) { if (typedMessage.getResult() == null) { throw new IllegalArgumentException(String.format("JobCompleted message for %s has null error *and* result", ref)); } LOGGER.debug() .setMessage("marking job as successful") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .log(); repo.jobSucceeded( ref.getJobId(), ref.getOrganization(), message.getScheduled(), typedMessage.getResult()); } else { LOGGER.debug() .setMessage("marking job as failed") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .addData("error", message.getError()) .log(); repo.jobFailed( ref.getJobId(), ref.getOrganization(), message.getScheduled(), typedMessage.getError()); } } catch (final NoSuchElementException error) { LOGGER.warn() .setMessage("tried to job as complete, but job no longer exists in repository") .addData("ref", ref) .addData("scheduled", message.getScheduled()) .log(); killSelf(); return; } getSelf().tell(new Reload.Builder<T>().setJobRef(ref).build(), getSelf()); }