2014-03-19 17:47 GMT+01:00 Yann Simon <[email protected]>: > > 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'd wish the specs to be much more precise for this sort of behavior, > >> because it is now quite impossible to write a ReadListener that can > >> run both on Jetty and Tomcat for example. > >> > > > > Other async APIs like NIO2 are not any more "precise" on purpose about > the > > threading model, because this allows being flexible and have better > > performance. You could use a semaphore to implement your desired > behavior. > > Thx for the hint, I'll try that. But I doubt to find a solution that > works on all containers. > I don't see how it could do worse than straight syncing. Rémy
