AsynchronousSocketChannel: abortable operations throw RuntimeException

Alan Bateman Alan.Bateman at oracle.com
Thu Oct 14 07:03:34 PDT 2010


Gili wrote:
> Hi Alan,
>
> Obviously you'd need to find a shorter method name like timeoutCloses() but
> the basic idea here is that the value would be constant throughout the
> implementation lifetime. I am hoping (though this is not required) that you
> will be able to provide class-level guarantees at compile-time, such as:
> "All implementations of AsynchronousSocketChannel will return true for
> timeoutCloses()." 
In this API, it's only cancel(true) that may close the channel. The 
timeout support specified by AsynchronousSocketChannel is effectively 
like cancel(false) and does not close the channel. From your previous 
mail, I assumed were asking for a method to find out if cancel(false) or 
timeout can guarantee to cancel underlying I/O operations with a 
guarantee that the connection will be in consistent state (which 
suggests that were you looking for a way to continue to use the 
connection after cancellation, something the spec cannot guarantee).

-Alan.


More information about the nio-discuss mailing list