MessageEndpoint endpoint = null;
try
{
MessageEndpointFactory endpointFactory = (MessageEndpointFactory)jobExecutionContext.getJobDetail().getJobDataMap().get("endpointFactory");
endpoint = endpointFactory.createEndpoint(null);
if (endpoint != null)
{
Job job = (Job) endpoint;
job.execute(jobExecutionContext);
}
else
{
log.error("ENDPOINT IS NULL!!!!");
}
}
catch (UnavailableException e)
{
throw new JobExecutionException(e);
}
finally
{
if (endpoint != null)
{
endpoint.release();
}
}