Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to use async processing with 3.1 async IO correctly?


On Tue, Nov 26, 2013 at 8:12 AM, Gaurav Kumar <gauravphoenix@xxxxxxxxx> wrote:
> I've setup a Github rep for this. Please run following commands -
> git clone git@xxxxxxxxxx:gauravphoenix/jetty91asyncIO.git
> cd jetty91asyncIO/jettyTest/
> mvn package
> java  -Dlog4j.configurationFile=./src/main/resources/log4j.xml  -jar
> target/jettyTest-1.0-SNAPSHOT.jar
> Now, change your browser proxy to localhost:80.
> As you can see, the in the code, it acts as a simple HTTP proxy. If you
> visit any website (not HTTPS, only HTTP site), you can see first few
> requests go just fine through proxy but after that nothing really happens.
> If you try to download a single large file (I've tested with 500+ MB file)
> it works just fine. So my hunch is that it is the number of requests which
> matter and not size of data written back to the client.
> Also, as you can see I'm NOT using async processing- just simple async IO.
> Note that if I don't use ASYNC IO and only async processing, everything
> works just fine.

I have doubts that "works just fine".
Your proxy class is not thread safe therefore all your bets are off.
Furthermore, I don't know much about the http client you're using, but
I would verify that the response content remains valid even after the
response object goes out of scope.
Sorry but you need to fix your code for good before tackling any async I/O.

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

Back to the top