Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Where does Jetty dispatch to worker thread happens.


On Fri, Oct 17, 2014 at 8:15 AM, Monish Gandhi <monishgandhi@xxxxxxxxx> wrote:
> I am trying to understand Jetty's Connector implementation which uses
> multiple acceptor/selectors to have non blocking implementation. I saw a
> post from Simone where its explained very clearly
> I could see the Jetty's  SelectorManager, AbstractConnector, ServerConnector
> implementing the same where we have n acceptor and m selector threads
> started. The acceptors are blocking on the ServerSocketChannels accept()
> call, each time when the socket connects, acceptor takes the socket and
> registers the channel with selector and submits the job to selector
> (ManagedSelector' ConcurrentArrayQueue) selector threads would poll the
> queue and run the changes. However i am somehow missing one thing, where is
> the actual dispatch happening to the Worker threads (the actual Server
> threads in QueuedThreadPool). Also let me know if I got some of above
> incorrectly

The dispatch happens when calling SelectChannelEndPoint.onSelected()
-> getFillInterest().fillable().
This goes back to the callback that the Connection registered with the
EndPoint, AbstractConnection.ReadCallback.
Here, the state goes (typically) from FILL_INTERESTED to FILLING, and
AbstractConnection.FillingState is where the dispatch happens, calling
Connection.onFillable() in the dispatched thread.

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