tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Simon <>
Subject Tomcat 8.0.0-RC5: asynchron IO and back pressure with ReadListener
Date Wed, 08 Jan 2014 17:04:37 GMT

I am trying to write a servlet that asynchronously read data from the
servlet request input stream.
I tested my servlet with tomcat 8.0.0-RC5.

the symptoms:
- I must synchronously read the input stream in onDataAvailable() so
that the upload works

what I expected:
I want to be more "reactive" (buzzword of the moment) and not read the
input stream until I am ready (=until the previous chunk is processed)
I though I could return from onDataAvailable() before having read all
the data, read the data in another thread. I expected
onDataAvailable() to be called again when I consumed all the data
(servletInputStream.isReady becomes false)
That way, I could implement back pressure on the browser as long as my
servlet has not finished its work with the actual chunk

But if I do that, neither onDataAvailable() nor onAllDataRead() is called again.

When I consume the input stream synchronously in onDataAvailable(), it
works as expected.

Am I misunderstanding the asynchron IO in Tomcat 8?

Thanks in advance for any ideas!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message