@Override public BoxedUnit apply() { timeout.cancel(); return null; } });
@Override public void run(Timeout timeout) throws Exception { if (timeout.isCancelled()) { return; } logger.info("Ownership cache : {} streams cached, {} hosts cached", stream2Addresses.size(), address2Streams.size()); logger.info("Cached streams : {}", stream2Addresses); scheduleDumpOwnershipCache(); }
private void cancelRequestTimeouts(Request request) { Timeout sendTimeout = request.getSendTimeout(); if (sendTimeout != null && !sendTimeout.isCancelled()) { sendTimeout.cancel(); } Timeout receiveTimeout = request.getReceiveTimeout(); if (receiveTimeout != null && !receiveTimeout.isCancelled()) { receiveTimeout.cancel(); } Timeout readTimeout = request.getReadTimeout(); if (readTimeout != null && !readTimeout.isCancelled()) { readTimeout.cancel(); } }
public void cancel() { if (cancelled.compareAndSet(false, true)) { if (requestTimeout != null) { requestTimeout.cancel(); RequestTimeoutTimerTask.class.cast(requestTimeout.getTask()).clean(); requestTimeout = null; } if (readTimeout != null) { readTimeout.cancel(); ReadTimeoutTimerTask.class.cast(readTimeout.getTask()).clean(); readTimeout = null; } } } }
public void run(Timeout timeout) throws Exception { if (timeout.isCancelled()) return; final long timestamp = System.currentTimeMillis(); final long deltaTime = timestamp - lastTimestamp; long sent = bytesSent.get() - lastBytesSent; long received = bytesReceived.get() - lastBytesReceived; lastBytesSent = bytesSent.get(); lastBytesReceived = bytesReceived.get(); if (sent < 0) sent = 0; if (received < 0) received = 0; sentHistory.add(sent / deltaTime); receivedHistory.add(received / deltaTime); if (sentHistory.size() > HISTORY_SIZE) sentHistory.removeFirst(); if (receivedHistory.size() > HISTORY_SIZE) receivedHistory.removeFirst(); bytesSentPerSecond.set(average(sentHistory) * 1000); bytesReceivedPerSecond.set(average(receivedHistory) * 1000); lastTimestamp = timestamp; timeout.getTimer().newTimeout(timeout.getTask(), RESOLUTION, TimeUnit.MILLISECONDS); }
@Override public void run(Timeout timeout) throws Exception { if (stopped || timeout.isCancelled()) { return; } log.trace("Collecting stats for {}", pcepTunnelId); sendTunnelStatistic(); if (!stopped && !timeout.isCancelled()) { log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval, pcepTunnelId); timeout.getTimer().newTimeout(this, refreshInterval, TimeUnit.SECONDS); } }
scheduleNewIdleChannelDetector(timeout.getTask());
@Override public void run(Timeout timeout) throws Exception { log.trace("Collecting stats for {}", sw.getStringId()); sendGroupStatistic(); if (!this.stopTimer) { log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval, this.sw.getStringId()); timeout.getTimer().newTimeout(this, refreshInterval, TimeUnit.SECONDS); } }
public void cancel() { if (cancelled.compareAndSet(false, true)) { if (requestTimeout != null) { requestTimeout.cancel(); RequestTimeoutTimerTask.class.cast(requestTimeout.getTask()).clean(); requestTimeout = null; } if (readTimeout != null) { readTimeout.cancel(); ReadTimeoutTimerTask.class.cast(readTimeout.getTask()).clean(); readTimeout = null; } } } }
@Override public void run(Timeout to) throws Exception { if (stopped || timeout.isCancelled()) { return; } log.trace("Collecting stats for {}", sw.getStringId()); sendPortStatistic(); if (!stopped && !timeout.isCancelled()) { log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval, this.sw.getStringId()); timeout.getTimer().newTimeout(this, refreshInterval, TimeUnit.SECONDS); } }
@Override public void run(Timeout to) throws Exception { for (DeviceId devId : flowTable.keySet()) { providerService.pushFlowMetrics(devId, flowTable .getOrDefault(devId, Collections.emptySet())); } timeout = timer.newTimeout(to.getTask(), 5, TimeUnit.SECONDS); } }
@Override public void run(Timeout timeout) throws Exception { log.debug("Collecting stats for {}", this.sw.getSwitchName()); sendPortStatistics(); sendFlowStatistics(0, (short) 0); if (!this.stopTimer) { log.debug("Scheduling stats collection in {} seconds for {}", this.refreshInterval, this.sw.getSwitchName()); timeout.getTimer().newTimeout(this, refreshInterval, TimeUnit.SECONDS); } }
private void cancelHandshakeTimeout() { if (handshakeTimeout != null) { // cancel the task as we will fail the handshake future now handshakeTimeout.cancel(); } }
@Override public void run(Timeout timeout) throws Exception { if (!timeout.isCancelled()) { serviceTimeout.inc(); handleServiceTimeout("Operation " + op.getClass().getName() + " timeout"); } } }, serviceTimeoutMs, TimeUnit.MILLISECONDS);
public void cancel() { if (cancelled.compareAndSet(false, true)) { if (requestTimeout != null) { requestTimeout.cancel(); RequestTimeoutTimerTask.class.cast(requestTimeout.getTask()).clean(); requestTimeout = null; } if (readTimeout != null) { readTimeout.cancel(); ReadTimeoutTimerTask.class.cast(readTimeout.getTask()).clean(); readTimeout = null; } } } }
public void run(Timeout timeout) throws Exception { if (isClosed.get()) return; try { if (LOGGER.isDebugEnabled()) for (String key : poolsPerKey.keySet()) { LOGGER.debug("Entry count for : {} : {}", key, poolsPerKey.get(key).size()); } long start = millisTime(); int closedCount = 0; int totalCount = 0; for (ConcurrentLinkedQueue<IdleChannel> pool : poolsPerKey.values()) { // store in intermediate unsynchronized lists to minimize the impact on the ConcurrentLinkedQueue if (LOGGER.isDebugEnabled()) totalCount += pool.size(); List<IdleChannel> closedChannels = closeChannels(expiredChannels(pool, start)); pool.removeAll(closedChannels); int poolClosedCount = closedChannels.size(); closedCount += poolClosedCount; } long duration = millisTime() - start; LOGGER.debug("Closed {} connections out of {} in {}ms", closedCount, totalCount, duration); } catch (Throwable t) { LOGGER.error("uncaught exception!", t); } scheduleNewIdleChannelDetector(timeout.getTask()); } }
public void operationComplete(ChannelFuture future) throws Exception { timeout.cancel(); } }
@Override synchronized public void run(Timeout timeout) throws Exception { if (!timeout.isCancelled() && null != nextAddressToSend) { doSend(nextAddressToSend); } else { fail(null, new CancelledRequestException()); } } }
scheduleNewIdleChannelDetector(timeout.getTask());
private static void destroy(ChannelHandlerContext ctx) { State state = state(ctx); synchronized (state) { if (state.state != 1) { return; } state.state = 2; } if (state.readerIdleTimeout != null) { state.readerIdleTimeout.cancel(); state.readerIdleTimeout = null; } if (state.writerIdleTimeout != null) { state.writerIdleTimeout.cancel(); state.writerIdleTimeout = null; } if (state.allIdleTimeout != null) { state.allIdleTimeout.cancel(); state.allIdleTimeout = null; } }