On 06/03/2015 15:14, Rémy Maucherat wrote:
> Hi (Mark - nobody else will care I suppose),
> 
> Since the SocketWrapperBase has been neatly factored away, I think scatter
> gather NIO2 style calls should be added to it for future use.
> 
> -     public <A> void write(ByteBuffer[] srcs, int offset, int length,
>             long timeout, TimeUnit unit, A attachment,
>             CompletionHandler<Long,? super A> handler)
> The main semantic difference with real NIO2 would be that it will write ALL
> the content instead of some of it and let people deal with it for no good
> reason (thanks ...).
> - Scatter would be new since the NIO2 connector Nio2Channel doesn't have it
> at the moment, its goal is to avoid additional parsing for protocols which
> use fixed lengths for some of their fields (this should be the case); it is
> probably less useful than gather though
>     public abstract <A> void read(ByteBuffer[] dsts,
>                                   int offset,
>                                   int length,
>                                   long timeout,
>                                   TimeUnit unit,
>                                   A attachment,
>                                   CompletionHandler<Long,? super A>
> handler);
> To help protocol implementation even more, maybe it would be possible to
> add an extra parameter to specify a minimum amount of bytes read, or
> (better) some additional interface to check if more bytes should be read
> before calling the completion handler
> 
> I'm not sure how useful it is to also add the other simpler read/write
> method variants or the future styled ones, I'd say it is useless though. At
> first the new calls could be added to Nio2SocketWrapper before getting
> pulled up once the two others implement it.
> 
> Comments ?

I can see how both might be useful. No objections here.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to