2014-01-30 Yann Simon <yann.simon...@gmail.com>:

> Hi,
>
> I wrote a sample app to demonstrate the problem:
> https://github.com/yanns/servlet31_async
>
> You can generate an exploded war with maven: mvn war:exploded
> I deployed the application in tomcat 8.0.0-RC10.
>
> The 2 upload form does work.
> The 1st upload form uses a new thread in , and that does not work.
>
> https://github.com/yanns/servlet31_async/blob/master/src/main/java/com/yann/ReadListenerImpl.java#L22
>
> The "onDataAvailable" is called only one time.
>
> With jetty, it does work (mvn jetty:run)
>
> I hope this can help.
>

You must read data until the ready flag flips, and you must do it in the
onDataAvailable invocation (= synchronously). Asynchronous reads is not the
threading and sync model that was chosen by the specification, so you
should simply not do that. I doubt it will reliably work in any container
since it is almost certain you can run in thread safety issues.

Rémy

Reply via email to