/** This transaction will be marked for rollback. A command will be associated with the
* Transaction.EVENT_AFTERCOMPLETION (after the job locks of the current transaction are
* released). Then the command will update the job with the exception details in a separate
* transaction. */
protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Throwable exception) {
Transaction transaction = environment.get(Transaction.class);
// transaction.setRollbackOnly();
CommandService commandService = (CommandService) environment.get(CommandService.class);
JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
transaction.registerSynchronization(jobExceptionHandler);
}