One option I am trying is to ignore onAllDataRead and to use
sevletInputStream.isFinished to know when the body is totally
consumed:

https://github.com/yanns/servlet31_async/blob/master/src/main/java/com/yann/ReadListenerImpl.java#L55

Is it a dumb idea?

2014-03-20 7:42 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
> Thanks Rémy and Mark for the quick feedback and explanations!
>
> On Mar 19, 2014 6:40 PM, "Mark Thomas" <ma...@apache.org> wrote:
>>
>> On 19/03/2014 17:04, Rémy Maucherat wrote:
>> > 2014-03-19 17:47 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>> >
>> >>> This is because you're forking a thread, it won't concurrently invoke
>> >>> the
>> >>> two events (which would be invalid).
>> >>
>> >> Can you explain more please? I have difficulties to understand your
>> >> sentence.
>> >>
>> >
>> > It means the container has to wait until onReadPossible completes to
>> > call
>> > onDataAvailable.
>>
>> I think Rémy meant Tomcat waits for onReadPossible() to complete before
>> calling onAllDataRead()
>>
>> If you look at the traces from the sample code, you'll see that the
>>
>> onDataAvailable end
>>
>> message always appears before
>>
>> onAllDataRead
>>
>> which is all you can rely on. You are seeing slightly odd behaviour
>> because you are spawning a new thread to do the read. If you do that you
>> have to handle the case that your new thread may trigger the
>> onAllDataRead event and handle it appropriately. I don't see anything
>> for Tomcat to do here.
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>

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

Reply via email to