Hi.
Everyone praises Executor framework (that one in java.util.concurrent). But I'm stucked with such a problem.
I want to execute different tasks in
thread pool and don't want to wait for their results in get method of Future interface. I just want some things to be done immediately after the execution completes (either with return or with exception). The only thing I was able to find to implement such listening for task completion is protected method of ThreadPoolExecutor class - afterExecute. This brings two unpleasant things: extending executor and messing with afterExecute parameters (Runnable, Throwable).
I wonder why the creators of Executor framework couldn't just provide the setter for listener interface in order to pass him the results (something like Future) upon task completion? Am I missing something? Why choosing between synchronous get and unhandy afterExecute?
Can you advise any technique to solve my problem? It seems to be so trivial, just returning results upon completion. That is why I can't believe the framework is not suitable for such scenario.
P.S. I use
java 5.