* released). Then the command will update the job with the exception details in a separate
* transaction. */
protected void handleJobExecutionException(Environment environment, JobImpl<?> job, Exception exception) {
Transaction transaction = environment.get(Transaction.class);
CommandService commandService = (CommandService) environment.get(CommandService.NAME_NEW_TX_REQUIRED_COMMAND_SERVICE);
JobExceptionHandler jobExceptionHandler = new JobExceptionHandler(job.getDbid(), exception, commandService);
transaction.registerSynchronization(jobExceptionHandler);
if (exception instanceof RuntimeException) {
throw (RuntimeException) exception;
}