tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rémy Maucherat <r...@apache.org>
Subject Re: Drop SocketWrapperBase.write(Non)BlockingDirect methods
Date Wed, 27 Nov 2019 17:07:42 GMT
On Wed, Nov 27, 2019 at 5:35 PM Mark Thomas <markt@apache.org> wrote:

> On 27/11/2019 15:59, Rémy Maucherat wrote:
> > On Wed, Nov 27, 2019 at 4:51 PM Mark Thomas <markt@apache.org
> > <mailto:markt@apache.org>> wrote:
> >
> >     I've been looking at the 9.0.x changes.
> >
> >     What is clearer now (I think the differences were always there - just
> >     harder to see with the more complex code) is that there are some
> minor
> >     differences in behaviour when all of the following are true:
> >     - the source buffer is emptied when it is copied to the socket buffer
> >     - the socket buffer is full after the source buffer has been copied
> >
> >     In some cases there will be an immediate write to the network. In
> other
> >     cases the network write will wait until the next write to the socket
> >     buffer or the next explicit flush.
> >
> >     I think I prefer an immediate write in this scenario. WDYT to
> updating
> >     (very carefully) all of the write methods to behave that way?
> >
> >
> > Ah personally I did prefer not writing that full buffer (unless the
> > source still has data, of course) on purpose since I considered not
> > doing IO reduced the likelihood to block on IO (or write 0 for non
> > blocking and having to use the poller). That's possible though if you
> > like it better.
>
> My preference for writing earlier is only a slight one. I'm more
> concerned that different methods take a different approach. Taking a
> closer look at that is on my TODO list but it isn't a priority for me at
> the moment.
>

I'll double check the inconsistency :)

writeBlocking writes after.
writeNonBlockingInternal has that  "&&
!socketBufferHandler.isWriteBufferWritable()" in the while loop that makes
the thing inconsistent, it is a leftover from the old code.
For now I'll fix that.

Rémy

Mime
View raw message