Thread pooling in AIO?
Alan Bateman
Alan.Bateman at Sun.COM
Wed Dec 17 00:55:48 PST 2008
David M. Lloyd wrote:
> :
> Interesting. To me that suggests that there ought to be a special
> Executor or ThreadFactory implementation for the Windows case then -
> one which knows not to kill a thread if there's an outstanding
> operation on it.
The default thread pool does the right thing but we don't have a
solution for the case where the user/application provides the
ExecutorService. A possible hack is to specifically handle the
ThreadPoolExecutor case and invoke its setKeepAliveTime to disable
trimming back of the thread pool. That doesn't solve the issue
completely though as it is possible for a completion handler to
terminate due to an uncaught error or runtime exception. For that case
the thread is allowed to terminate (ensures the uncaught exception
handler is invoked, etc.) but it sets us up for potential side effects.
It has not been a problem to date and clearly this scenario is the
result of a bug somewhere.
-Alan.
More information about the nio-discuss
mailing list