List of usage examples for io.netty.handler.traffic GlobalTrafficShapingHandler GlobalTrafficShapingHandler
public GlobalTrafficShapingHandler(ScheduledExecutorService executor, long checkInterval)
From source file:appium.android.server.http.TrafficCounter.java
License:Apache License
private static void initIfNecessary() { if (executorService == null || executorService.isShutdown()) { executorService = Executors.newScheduledThreadPool(1); }/*from w w w.ja va2 s . c o m*/ if (shaper == null) { shaper = new GlobalTrafficShapingHandler(executorService, 500); } }
From source file:cc.agentx.server.Configuration.java
License:Apache License
public static void init() throws Exception { if (INSTANCE != null) { return;//from w w w . ja v a 2s.co m } log.info("\tLoading configuration file..."); load(); log.info("\tChecking configuration items..."); check(); if (INSTANCE.relayPort.length > 0) { log.info("\tStarting Relays..."); startupRelays(); } log.info("\tInitializing dns cache..."); DnsCache.init(INSTANCE.dnsCacheCapacity); log.info("\tInitializing global network traffic handler..."); TRAFFIC_HANDLER = new GlobalTrafficShapingHandler(Executors.newScheduledThreadPool(1), 1000); TRAFFIC_HANDLER.setWriteLimit(INSTANCE.writeLimit); TRAFFIC_HANDLER.setReadLimit(INSTANCE.readLimit); log.info("\tEnd of configuration"); }
From source file:org.aotorrent.common.TorrentEngine.java
License:Apache License
public TorrentEngine(Torrent torrent, InetSocketAddress address, EventLoopGroup workerGroup) { this.torrent = torrent; this.address = address; this.workerGroup = workerGroup; counter = new GlobalTrafficShapingHandler(workerGroup, 1000); writeThreadPool = Executors.newSingleThreadExecutor(); }