public void resetTimeout() { final ThreadAttachment localThreadAttachment = threadAttachment; if (localThreadAttachment != null) { localThreadAttachment.setTimeout(System.currentTimeMillis()); } }
/** * Switch back to keep-alive timeout mode. */ private void enableTimeout() { final ThreadAttachment attachment = obtainAndSetThreadAttachment(); attachment.setIdleTimeoutDelay(SelectionKeyAttachment.UNSET_TIMEOUT); attachment.setTimeout(System.currentTimeMillis()); }
@Override public void doRegisterKey(SelectionKey key, int ops, long currentTime) { if (!key.isValid() || !selectorThread.getKeepAliveCounter().trap(key)) { selectorThread.cancelKey(key); return; } // If the SelectionKey is used for continuation, do not allow // the key to be registered. if (selectorThread.getEnableAsyncExecution() && !bannedKeys.isEmpty() && bannedKeys.remove(key)){ return; } key.interestOps(key.interestOps() | ops); Object attachment = key.attachment(); // By default, attachment a null. if (attachment == null) { key.attach(currentTime); } else if (attachment instanceof ThreadAttachment) { ((ThreadAttachment) attachment).setTimeout(currentTime); } }
ctx.getSelectionKey().attach(null); } else { wt.getAttachment().setTimeout(null);
ctx.getSelectionKey().attach(null); } else { workerThread.getAttachment().setTimeout(null);
ctx.getSelectionKey().attach(null); } else { workerThread.getAttachment().setTimeout(SelectionKeyAttachment.UNLIMITED_TIMEOUT);