*/
ResponderProcessWrapper processWrapper = null;
try
{
ActiveProcess process = assignJob();
if (process == null)
{
logger.info("No work currently available.");
Thread.sleep(NO_WORK_WAIT);
return;
}
processWrapper = new ResponderProcessWrapper(
clientRuntime, activeProcessDao, process);
}
catch(Exception e)
{
e.printStackTrace();
logger.log(Level.INFO,"Either failed to obtain an item of work, "
+ "or failed to process it: " + "{0}", e.getMessage());
return;
}
ActiveProcess process = processWrapper.getProcess();
logger.log(Level.INFO, "Going to process: {0}", process.getGuid());
//These flags prevent unnecessary tidyup work after job execution
boolean registered = false;
// boolean installed = false;
try
{
//JobWrapper - register process (actually starts a thread to do this regularly)
/*
* Registers the ActiveProcess object created in the previous step
* with Microbase distributed task list. If, by this time, there are too
* many running instances of the responder that ActiveProcess represents,
* then a ProcessRegistrationException will be thrown.
*/
processWrapper.registerProcess();
registered = true;
//JobWrapper - install job
processWrapper.install();
// installed = true;
//JobWrapper - run job
processWrapper.runJob();
}
catch(ProcessRegistrationException e)
{
logger.log(Level.INFO, "Responder: {0} failed to start because: {1}",
new Object[]{process.getResponder().getTaskTypeGuid(), e.getMessage()});
//e.printStackTrace();
}
catch(ProcessingException e)
{
logger.log(Level.INFO,
"Responder: {0} either failed to install or failed to "
+ "execute correctly", process.getResponder().getTaskTypeGuid());
e.printStackTrace();
}
finally
{
//No need to do this with a WS.