AsynchronousDatagramChannel read/write spec issue
Alan.Bateman at Sun.COM
Mon Mar 9 05:05:07 PDT 2009
> Hi Alan,
> AsynchronousDatagramChannel specification class description says
> "Asynchronous datagram channels allow more than one read/receive and
> write/send to be outstanding at any given time. ". This statement
> seems to contradict the AsynchronousDatagramChannel.read() method
> specification which says "If a thread initiates a read operation
> before a previous read operation has completed then a
> ReadPendingException will be thrown. " and
> AsynchronousDatagramChannel.write() method spec which says "If a
> thread initiates a write operation before a previous write operation
> has completed then a WritePendingException will be thrown."
> Could you please clarify this.
As AsynchronousDatagramChannel is not connected to a stream-oriented
connection then you can have several outstanding I/O operations. The
issue here is that read/write methods inherited from
AynchronousByteChannel have their method descriptions copied, by
javadoc, from the interface. The wording in AynchronousByteChannel
delegates the decision on if more than one read (or write) can be
outstanding at a time I'll sort out this descriptions for the next
build - thanks for finding this!
More information about the nio-dev