protected void registerWithJobExecutor(CommandContext commandContext, DeploymentEntity deployment) {
try {
new RegisterDeploymentCmd(deployment.getId()).execute(commandContext);
} finally {
DeploymentFailListener listener = new DeploymentFailListener(deployment.getId());
try {
commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, listener);
} catch (Exception e) {
log.log(Level.FINE, "Could not register transaction synchronization. Probably the TX has already been rolled back by application code.", e);
listener.execute(commandContext);
}
}
}