org.jboss.netty.util.Timeout.getTask()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.jboss.netty.util.Timeout.getTask()方法的一些代码示例,展示了Timeout.getTask()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeout.getTask()方法的具体详情如下:
包路径:org.jboss.netty.util.Timeout
类名称:Timeout
方法名:getTask

Timeout.getTask介绍

[英]Returns the TimerTask which is associated with this handle.
[中]返回与此句柄关联的TimerTask。

代码示例

代码示例来源:origin: com.ning/async-http-client

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;
      }
    }
  }
}

代码示例来源:origin: com.ning/async-http-client

scheduleNewIdleChannelDetector(timeout.getTask());

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3

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;
      }
    }
  }
}

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3-provider

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;
      }
    }
  }
}

代码示例来源:origin: org.onosproject/onos-netconf-provider-flow

@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);
  }
}

代码示例来源:origin: cgbystrom/netty-tools

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);
}

代码示例来源:origin: io.gatling/async-http-client

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());
  }
}

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3

scheduleNewIdleChannelDetector(timeout.getTask());

代码示例来源:origin: org.asynchttpclient/async-http-client-netty3-provider

scheduleNewIdleChannelDetector(timeout.getTask());

相关文章