private void notifyWriteTimeout(SocketSessionImpl session,
long currentTime, long writeTimeout, long lastIoTime) {
SelectionKey key = session.getSelectionKey();
if (writeTimeout > 0 && (currentTime - lastIoTime) >= writeTimeout
&& key != null && key.isValid()
&& (key.interestOps() & SelectionKey.OP_WRITE) != 0) {
session.getFilterChain().fireExceptionCaught(session,
new WriteTimeoutException());
}
}