jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: [servlet-spec users] Re: Initial draft of NIO proposal

From: Greg Wilkins <gregw_at_intalio.com>
Date: Thu, 15 Sep 2011 17:31:47 +1000

On 15 September 2011 16:37, Rajiv Mordani <rajiv.mordani_at_oracle.com> wrote:
> So are you saying that you don't want the WriteListener and ReadListener but
> more the APIs like the NIO2 as you suggest below? Also would you add them to
> the InputStream and also create a ServletWriter as Shing Wai suggested
> earlier?

I've not really got a strong preference either way yet.

The style of API that you have proposed (and the Remy has implemented)
is pretty similar to what I've used before in many different
environments. But as Remy says, using such APIs is not a trivial
exercise, but then it's not that unusual either.

The NIO.2 API in java7 has introduced another style of doing
asynchronous IO and my brief exposure to it has suggested that it has
the benefit of being and obvious and simple API to use, but with at
least the scalability problem of the pre-allocated buffers. So
I'm really just floating the idea of coming up with an async IO API
that is closely aligned to the java7 style, so that we can get the
benefits of the joint education.

Also if we want to do async operations on characters, then NIO.2
style, that calls back when an operation is complete is better than
the other style - because we would have to deal with a write(char[])
coming back and saying it has written 4 chars and 2 bytes of the 5th
char.

With regards to which classes these methods go on... again no strong
preference, other than to minimise the number of new classes/methods
if we can.

cheers