AsynchronousByteChannel and scatter/gather
Alan.Bateman at Sun.COM
Fri Jun 6 02:09:24 PDT 2008
[ moving to nio-discuss (if okay with you) as there are folks interested
in this area that don't subscribe to the -dev mailing list ]
David M. Lloyd wrote:
> I've noticed that AsynchronousByteChannel doesn't support
> scatter/gather operations; yet the most of the channels that implement
> this interface have scatter/gather operations. Is there any plan to
> provide a scatter/gather-capable version of the interface? Or merge
> those methods onto the base interface?
Only AsynchronousSocketChannel defines scatter/gather operations at this
time. A possible candidate to also define these operations in the future
is AsynchronousDatagramChannel but there hasn't been sufficient
motivation to date. We could add asynchronous variants of the
scatter/gather interfaces later if they are needed.
> Also, I see that Pipes do not support the asynchronous operation at
> all. Any particular reason?
Pipes can only be used for communication within the same VM. I haven't
seen an application that uses more than a handful of them at the same
time and I don't expect scalability is an issue. It would be relatively
simple to use a thread pool + Pipe's existing channels if someone really
needs to combine asynchronous I/O with I/O to pipes (ie: we don't need
to add anything to the API to support that). That said, there is some
interest in named pipes support for interoperability with native
applications and local IPC between VMs on the same machine. This isn't
in our scope here but something I have been explored with a view to
supporting other protocols in the future. In that case, both
SocketChannel and AsynchronousSocketChannel could be used with Unix
domain sockets sockets for example.
More information about the nio-dev