if(jobHandlerActivation == null) {
// TODO: stop acquisition / only activate acquisition if MDB active?
log.warning("Cannot execute acquired job, no JobExecutionHandler MDB deployed.");
return;
}
MessageEndpoint endpoint = null;
try {
endpoint = jobHandlerActivation.getMessageEndpointFactory().createEndpoint(null);
try {
endpoint.beforeDelivery(method);
} catch (NoSuchMethodException e) {
log.log(Level.WARNING, "NoSuchMethodException while invoking beforeDelivery() on MessageEndpoint '"+endpoint+"'", e);
} catch (ResourceException e) {
log.log(Level.WARNING, "ResourceException while invoking beforeDelivery() on MessageEndpoint '"+endpoint+"'", e);
}
try {
((JobExecutionHandler)endpoint).executeJob(nextJobId, commandExecutor);
}catch (Exception e) {
log.log(Level.WARNING, "Exception while executing job with id '"+nextJobId+"'.", e);
}
try {
endpoint.afterDelivery();
} catch (ResourceException e) {
log.log(Level.WARNING, "ResourceException while invoking afterDelivery() on MessageEndpoint '"+endpoint+"'", e);
}
} catch (UnavailableException e) {
log.log(Level.SEVERE, "UnavailableException while attempting to create messaging endpoint for executing job", e);
} finally {
if(endpoint != null) {
endpoint.release();
}
}
}