AsynchronousSocketChannel: abortable operations throw RuntimeException
cowwoc at bbs.darktech.org
Thu Oct 14 06:20:01 PDT 2010
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()." timeoutCloses() should be defined by
AsynchronousByteChannel, or (better yet) define a new interface that will
contain the read/write methods associated with timeouts (the ones with
CompletionHandlers) and define the method there. That way both
AsynchronousSocketChannel and AsynchronousSerialPortChannel can take
advantage of AsynchronousByteCharChannel that will convert an
AsynchronousByteChannel to an AsynchronousCharChannel.
AsynchronousSocketChannel won't be the only class implementing timeouts.
Alan Bateman wrote:
> I think by compile-time you actually mean at runtime because whether an
> implementation can cancel the underlying I/O operation or not, is highly
> implementation specific, and not something that is known at compile
> time. It's not clear to me that a
> supportsCancelWithGuaranteeThatNoBytesWereTransferred or some such
> method is really all that useful here. As I said, an
> AsynchronousSocketChannel is connected to a stream and you will almost
> always close the channel when there is an error, like a timeout.
View this message in context: http://nio-discuss.970641.n3.nabble.com/AsynchrnousSocketChannel-abortable-operations-throw-RuntimeException-tp1692482p1700947.html
Sent from the nio-discuss mailing list archive at Nabble.com.
More information about the nio-discuss