I'm experiencing different behavior when calling IoSession.write() and then adding an IoFutureListener to the returned WriteFuture depending on the thread from which the IoSession.write is called. Example:
WriteFuture future = session.write(someMessage); future.addListener(someListener); Now if that snippet of code is executed from the IoProcessor thread I see the IoFutureListener.operationComplete called followed by IoHandler.messageSent called. If the above snippet is called from a different there seems to be a race. Sometimes IoFutureListener.operationComplete is called followed by IoHandler.messageSent and sometimes the other way around. What seems to be happening is that when IoSession.write is called (from a non IoProcessor thread) IoFilterChain.filterWrite is fired, the message is added to the IoSession writeRequestQueue, and the IoProcessor writes the message and fires messageSent before the IoFutureListener is added to the WriteFuture. So my question is is this the expected behavior or is it a bug? -geoff
