currentJobId = jobId;
currentTaskId = taskId;
activeWorkers.add(this);
this.monitor.notifyStatusChanged("Obtaining task worker...");
TaskWorker worker;
try {
worker = getTaskWorker(jobId);
} catch (DelegationException e) {
worker = null;
} catch (ClassNotFoundException e) {
service.reportException(jobId, 0, e);
idle(EXCEPTION_IDLE_SECONDS, EXCEPTION_IDLE_MESSAGE);
worker = null;
}
if (worker == null) {
this.monitor.notifyStatusChanged("Could not obtain worker...");
this.monitor.notifyCancelled();
return;
}
this.monitor.notifyStatusChanged("Performing task...");
ClassLoader loader = worker.getClass().getClassLoader();
Object results;
try {
Object task = taskDesc.getTask().deserialize(loader);
results = worker.performTask(task, monitor);
} catch (DelegationException e) {
results = null;
} catch (Exception e) {
service.reportException(jobId, taskId, e);
idle(EXCEPTION_IDLE_SECONDS, EXCEPTION_IDLE_MESSAGE);