@Override protected void init(NioSession session) throws Exception { SelectableChannel ch = (SelectableChannel) session.getChannel(); ch.configureBlocking(false); selectorLock.readLock().lock(); try { session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session)); } finally { selectorLock.readLock().unlock(); } }
@Override protected void init(NioSession session) throws Exception { SelectableChannel ch = (SelectableChannel) session.getChannel(); ch.configureBlocking(false); selectorLock.readLock().lock(); try { session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session)); } finally { selectorLock.readLock().unlock(); } }
@Override protected void init(NioSession session) throws Exception { SelectableChannel ch = (SelectableChannel) session.getChannel(); ch.configureBlocking(false); session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session)); }
session.setSelectionKey(newKey);
session.setSelectionKey(newKey);