NIO2 async threading

Alan Bateman Alan.Bateman at Sun.COM
Mon Jun 16 01:16:05 PDT 2008


Rob Butler wrote:
> :
> That should probably be more explicit in the Javadoc.  These are the exact kind of threading behaviors people will want more info on.
>   
You're right, it is currently buried and could be moved into its own 
section.

> :
> Maybe either AsynchronousChannelGroup could have an additional setting, or the read method on AsynchronousSocketChannel could have an additional parameter.  This parameter could set the 'wait for more data' delay.  If it were on the read method a value of 0 (zero) could be passed if the request was complete, and a non-zero value in milliseconds would be passed to wait for 'more data' before releasing the thread to handle other requests.  This might improve performance similar to temporary selectors.  Of course some R&D would be necessary to see if it actually was beneficial or not.
>   
We probably need more feedback and experiences from people using the API 
before considering anything like this. Jean-Francois can correct me, but 
I believe his approach is a trade off to avoid the cost of 
re-registering with the main Selector and re-dispatchinh/handing off to 
continue the processing for the case that more data arrives within a few 
seconds. The approach may not carry over as there isn't the equivalent 
of a Selector that is managed by one thread. 

-Alan.



More information about the nio-discuss mailing list