executor for AsynchronousFileChannel.open()
Zhong Yu
zhong.j.yu at gmail.com
Thu Apr 24 20:43:01 UTC 2014
On Tue, Apr 10, 2012 at 10:18 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 10/04/2012 16:12, Zhong Yu wrote:
>>
>> Thanks Alan. You are right, in the context of heavy I/O operations, my
>> concern about threading overhead of the lightweight tasks is
>> overblown.
>>
>> I'll simply use the default thread pool with unbounded number of
>> threads. However one problem is that these threads never expire
>>
>> class sun.nio.ch.ThreadPool
>> static ThreadPool createDefault() {
>>
>> ExecutorService executor =
>> new ThreadPoolExecutor(0, Integer.MAX_VALUE,
>> Long.MAX_VALUE, TimeUnit.MILLISECONDS,
>> new SynchronousQueue<Runnable>(),
>> threadFactory);
>>
>> After peak load, the extra threads will stay forever. Some users might
>> find that unsettling. Shouldn't we set a human-scale timeout, like 60
>> seconds?
no.... they are still alive after 5 minutes.
Also, even if they have a timeout, if the application is active
enough, it'll prevent these threads from exiting, right? Then the
problem of referencing user classloader won't be alleviated.
>>
> It probably should, except for older versions of Windows where I/O
> operations are tied to the initiating thread so we can't let them terminate
> if there are outstanding I/O operations.
>
> -Alan.
More information about the nio-dev
mailing list