public abstract class HousekeepingTask<T> extends AbstractTask<T> { @Override public final void run() { setup(); // before executing the task execute(); // actually execute teardown(); // cleanup after execution } // replaces the run() method in subclasses public abstract void execute(); private void setup() { ... } private void teardown() { ... }}
Are you talking about something that would execute 1) after each individual task, or 2) after a set of tasks is completed and before a new one is received from the server?
you might want to try one of the jobXXX() methods
What I can propose here, is to add another method to the node listener, say "beforeNextJob()", which would be called after a job is sent back to the server and before a new one is read from the server.
[...] as the listeners suffer from network delays, [...] wouldn't it simply duplicate the functionality of the JobListener's jobReturned() method?