why not both Future and CompletionHandler?

Sangjin Lee sjlee at apache.org
Thu Apr 14 07:19:17 PDT 2011


Hi there,

This may have been discussed in the past, but my googling didn't turn up a
discussion...

I've been looking at the I/O methods on the AsynchronousSocketChannel, and
noticed that they let you interact with *either* Future or
CompletionHandler, but not both. Each method flavor seems to have a pair (or
more) of overloaded methods that lets you interact with the result only one
way. Is there a reason not to use methods that allow you to use both
mechanisms (Future and CompletionHandler) instead? For example,

public Future<Void> connect(SocketAddress remote, A attachment,
CompletionHandler<Void,? super A> handler);

Thanks!

Regards,
Sangjin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20110414/a1e2341e/attachment.html 


More information about the nio-dev mailing list