private void requestInterestOpsUpdate() { if (isSelectable()) { selectorThread.addInterestOpsUpdateRequest(sk); } }
/** * Iterate over the queue of connections ready to resume selection, * and restore their interest ops selection mask. */ private void processInterestOpsUpdateRequests() { SelectionKey key; while (!stopped && (key = updateQueue.poll()) != null) { if (!key.isValid()) { cleanupSelectionKey(key); } NIOServerCnxn cnxn = (NIOServerCnxn) key.attachment(); if (cnxn.isSelectable()) { key.interestOps(cnxn.getInterestOps()); } } } }
@Override public int getInterestOps() { if (!isSelectable()) { return 0; } int interestOps = 0; if (getReadInterest()) { interestOps |= SelectionKey.OP_READ; } if (getWriteInterest()) { interestOps |= SelectionKey.OP_WRITE; } return interestOps; }
if (cnxn.isSelectable()) { cnxn.close();