in src/main/java/com/amazonaws/codepipeline/jobworker/CodePipelineJobPoller.java [88:105]
private Runnable newProcessWorkItemRunnable(final WorkItem workItem) {
return () -> {
try {
final JobStatus jobStatus = jobService.acknowledgeJob(workItem.getJobId(), workItem.getClientId(), workItem.getJobNonce());
if (JobStatus.InProgress.equals(jobStatus)) {
LOGGER.info(String.format("Handing workItem for job %s to JobWorker", workItem.getJobId()));
final WorkResult result = jobProcessor.process(workItem);
reportJobStatus(workItem, result);
} else {
LOGGER.warn(String.format("Cannot process work item since AcknowledgeJob for job %s with nonce %s returned status %s",
workItem.getJobId(), workItem.getJobNonce(), jobStatus));
}
} catch(final RuntimeException e) {
LOGGER.error(String.format("Error occurred processing work item for job %s", workItem.getJobId()), e);
}
};
}