} catch (IOException ex) {
throw new IOReactorException("Failure registering channel " +
"with the selector", ex);
}
IOSession session = new IOSessionImpl(key, new SessionClosedCallback() {
public void sessionClosed(IOSession session) {
closedSessions.add(session);
}
});
int timeout = 0;
try {
timeout = channel.socket().getSoTimeout();
} catch (IOException ex) {
// Very unlikely to happen and is not fatal
// as the protocol layer is expected to overwrite
// this value anyways
}
session.setAttribute(IOSession.ATTACHMENT_KEY, entry.getAttachment());
session.setSocketTimeout(timeout);
this.sessions.add(session);
try {
keyCreated(key, session);