If you have been through the last recipe, you will already be familiar with the Callable task, so I won't give you more details about it here. But now, we are implementing our task using both the Callable and ManagedTaskListener interfaces. The second one gives us all the methods for checking the task's status:
@Override public void taskSubmitted(Future<?> future, ManagedExecutorService mes, Object o) { long mili = new Date().getTime(); LOG.log(Level.INFO, "taskSubmitted: {0} - Miliseconds since instantiation: {1}", new Object[]{future, mili - instantiationMili}); } @Override public void taskAborted(Future<?> future, ManagedExecutorService mes, Object o, Throwable thrwbl) { long mili = new Date().getTime(); LOG.log(Level.INFO, ...