why not both Future and CompletionHandler?

Alan Bateman Alan.Bateman at oracle.com
Thu Apr 14 11:14:24 PDT 2011


Wolfgang Baltes wrote:
>
> Rémi,
>
> As an addition to my previous reply: I didn't find clear semantics on 
> how to cancel an I/O operation; that is, I couldn't find a clear 
> explanation of what cancel() on a Future returned by an I/O operation 
> would actually do. Alan's memo seems to indicate that it may not do much.
>
> On the other side, the CompletionFuture I described allows 
> cancellation of the task (i.e., the argument to the constructor).
I/O and cancellation is a very awkward topic. We have a couple of 
paragraphs in the AsynchronousChannel description to set expectations 
that it may not be possible to cancel the underlying I/O operation and 
to also explain that when mayInterruptIfRunning is true, it is allowed 
to close the channel.

-Alan.


More information about the nio-dev mailing list