}
else if (!completed)
{
+ Cache.log.debug(format("Polling worker %s",
+ worker.getClass().getName()));
if (worker.poll())
{
Cache.log.debug(format("Worker %s finished",
}
if (completed)
{
- try
- {
- future.cancel(false);
- }
- catch (NullPointerException ignored)
- {
- // extremely unlikely to happen
- }
+ Cache.log.debug(format("Finalizing completed worker %s",
+ worker.getClass().getName()));
+ worker.done();
+ // almost impossible, but the future may be null at this point
+ // let it throw NPE to cancel forcefully
+ future.cancel(false);
}
}
};
task.cancel(false);
executor.submit(() -> {
worker.cancel();
+ Cache.log.debug(format("Finalizing cancelled worker %s",
+ worker.getClass().getName()));
+ worker.done();
});
}
}