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