Selecting NIO connector.
This connector uses efficient NIO buffers with a non blocking threading model. Direct NIO buffers
are used and threads are only allocated to connections with requests. Synchronization is used to
simulate blocking for the servlet API, and any unflushed content at the end of request handling
is written asynchronously.
This connector is best used when there are a many connections that have idle periods.
When used with
org.mortbay.util.ajax.Continuation , threadless waits are supported. When
a filter or servlet calls getEvent on a Continuation, a
org.mortbay.jetty.RetryRequest runtime exception is thrown to allow the thread to exit the current request handling. Jetty will
catch this exception and will not send a response to the client. Instead the thread is released
and the Continuation is placed on the timer queue. If the Continuation timeout expires, or it's
resume method is called, then the request is again allocated a thread and the request is retried.
The limitation of this approach is that request content is not available on the retried request,
thus if possible it should be read after the continuation or saved as a request attribute or as the
associated object of the Continuation instance.
author: gregw |