public void doWork() throws InterruptedException { if (!key.isValid()) { selectorThread.cleanupSelectionKey(key); return; } if (key.isReadable() || key.isWritable()) { cnxn.doIO(key); // Check if we shutdown or doIO() closed this connection if (stopped) { cnxn.close(); return; } if (!key.isValid()) { selectorThread.cleanupSelectionKey(key); return; } touchCnxn(cnxn); } // Mark this connection as once again ready for selection cnxn.enableSelectable(); // Push an update request on the queue to resume selecting // on the current set of interest ops, which may have changed // as a result of the I/O operations we just performed. if (!selectorThread.addInterestOpsUpdateRequest(key)) { cnxn.close(); } }
public boolean addInterestOpsUpdateRequest(SelectionKey sk) { return super.addInterestOpsUpdateRequest(sk); } }
private void requestInterestOpsUpdate() { if (isSelectable()) { selectorThread.addInterestOpsUpdateRequest(sk); } }