ThreadPoolJobManager.this.executor.purge();
}
if (printJob.getReportFuture().isDone()) {
submittedJobs.remove();
final Registry registryRef = ThreadPoolJobManager.this.registry;
try {
printJob.getReportFuture().get().store(registryRef, this.assertionPersister);
registryRef.incrementInt(NB_PRINT_DONE, 1);
registryRef.incrementLong(TOTAL_PRINT_TIME, printJob.getTimeSinceStart());
} catch (InterruptedException e) {
// if this happens, the timer task was interrupted. restore the interrupted
// status to not lose the information.
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
// TODO check if in this case the job remains in the registry with status pending!
registryRef.incrementInt(LAST_PRINT_COUNT, 1);
} catch (JSONException e) {
registryRef.incrementInt(LAST_PRINT_COUNT, 1);
} catch (CancellationException e) {
try {
final FailedPrintJob failedJob = new FailedPrintJob(
printJob.getReportRef(), printJob.getAppId(), new Date(), "", "task canceled (timeout)",
printJob.getAccessAssertion());
failedJob.store(registryRef, this.assertionPersister);
registryRef.incrementInt(NB_PRINT_DONE, 1);
registryRef.incrementLong(TOTAL_PRINT_TIME, printJob.getTimeSinceStart());
} catch (JSONException e1) {
registryRef.incrementInt(LAST_PRINT_COUNT, 1);
}
}
}
}
}