// Fire events only when no lock is hold for this handler.
if (Thread.holdsLock(this)) {
return;
}
IoFilterEvent event;
// We need synchronization here inevitably because filterWrite can be
// called simultaneously and cause 'bad record MAC' integrity error.
synchronized (this) {
while ((event = filterWriteEventQueue.poll()) != null) {
NextFilter nextFilter = event.getNextFilter();
nextFilter.filterWrite(session, (WriteRequest) event.getParameter());
}
}
while ((event = messageReceivedEventQueue.poll()) != null) {
NextFilter nextFilter = event.getNextFilter();
nextFilter.messageReceived(session, event.getParameter());
}
}