282930313233343536
@Override protected void handleSelectionKey(SelectionKey sk) { if (sk.isValid() && sk.isWritable()) { sk.interestOps(sk.interestOps() & ~SelectionKey.OP_WRITE); final SelectionHandler handler = (SelectionHandler) sk.attachment(); handler.handle(); } }
262728293031323334
super(threadGroup, "InSelector"); } protected void handleSelectionKey(SelectionKey sk) { if (sk.isValid() && sk.isReadable()) { final SelectionHandler handler = (SelectionHandler) sk.attachment(); handler.handle(); } }