Hi Oleg, Thank you for the reply. But I'm still a bit confused about the answer. So let me rephrase my question. When a worker thread enters outputReady(IOSession session) method with that session object, does that worker thread acquires a lock on OP_WRITE operation for that particular session object so that any other worker thread can't perform OP_WRITE operation on that session object?
As an example, assume there are two worker threads, Thread_A and Thread_B. Further, there is a IOSession object session_123 with its event set as OP_WRITE. Both threads, Thread_A and Thread_B see that OP_WRITE event is set for session_123 and can the both threads (Thread_A, Thread_B) enter the outputReady(IOSession session) method at the same time with the session_123 being the parameter passed to that method and execute the method's body? On Thu, Mar 27, 2014 at 1:52 PM, Oleg Kalnichevski <[email protected]> wrote: > On Wed, 2014-03-26 at 23:00 +0530, Sajith Dilshan wrote: > > Hi everyone, > > > > When I set the OP_WRITE event on a particular instance of > > org.apache.http.nio.reactor.IOSession, a worker thread will pick up that > > IOSession and will execute the outputReady(IOSession session) method of > the > > respective org.apache.http.nio.reactor.IOEventDispatch implementation. > > > > My question is that, is it possible for more than one thread to execute > > outputReady(IOSession session) method for the same instance of IOSession > at > > the same time? > > it is possible on multi CPU core systems. > > > Does a worker thread acquires a lock before executing > > outputReady(IOSession session) method for a particular IOSession > instance? > > > > Yes, it does. Access to IOSession's internal structures is synchronized. > IOSession-s are fully thread safe. > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
