private boolean genericExecuteJob(Hashtable jobHash, Object jobInput)
throws JobException {
JobInstance exec = null;
JobInput in = null;
try {
Job job = XmlRpcStructFactory.getJobFromXmlRpc(jobHash);
LOG.log(Level.INFO, "stub attempting to execute class: ["
+ job.getJobInstanceClassName() + "]");
exec = GenericResourceManagerObjectFactory
.getJobInstanceFromClassName(job.getJobInstanceClassName());
in = GenericResourceManagerObjectFactory
.getJobInputFromClassName(job.getJobInputClassName());
// load the input obj
in.read(jobInput);
// create threaded job
// so that it can be interrupted
RunnableJob runner = new RunnableJob(exec, in);
Thread threadRunner = new Thread(runner);
/* save this job thread in a map so we can kill it later */
jobThreadMap.put(job.getId(), threadRunner);
threadRunner.start();
try {
threadRunner.join();
} catch (InterruptedException e) {
LOG.log(Level.INFO, "Current job: [" + job.getName()
+ "]: killed: exiting gracefully");
synchronized (jobThreadMap) {
Thread endThread = (Thread) jobThreadMap.get(job.getId());
if (endThread != null)
endThread = null;
}
return false;
}
synchronized (jobThreadMap) {
Thread endThread = (Thread) jobThreadMap.get(job.getId());
if (endThread != null)
endThread = null;
}
return true;