8201315: (se) Allow SelectableChannel.register to be invoked while selection operation is in progress

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 11 08:35:01 UTC 2018


On 10/04/2018 11:33, Hamlin Li wrote:
> Hi Alan,
>
> Just a minor comment about the new test, should line 
> 101(result.get();) be moved into the finally block just before line 
> 104(pool.shutdown();)? So that sel is auto closed before trying to get 
> the result of selectLoop.
As it stands, the Selector is closed by the try-with-resources 
constructor. This causes the select to wakeup and the selectLoop task 
will terminate. The result.get() is just to check that the selectLoop 
task didn't terminate with an exception. It could be moved into the 
try-finally if we explicit close the selector, it should be the finally 
block, or after the try-finally, it shouldn't matter. If we go ahead 
with this approach then I'll probably add more tests.

-Alan


More information about the nio-dev mailing list