/** * @param newWriteLimit Channel write limit * @param newReadLimit Channel read limit */ public void configureChannel(long newWriteLimit, long newReadLimit) { writeChannelLimit = newWriteLimit; readChannelLimit = newReadLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
/** * @param readLimit Channel read limit */ public void setReadChannelLimit(long readLimit) { readChannelLimit = readLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
/** * @param writeLimit Channel write limit */ public void setWriteChannelLimit(long writeLimit) { writeChannelLimit = writeLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
/** * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param writeLimit the writeLimit to set */ public void setWriteLimit(long writeLimit) { this.writeLimit = writeLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
/** * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param readLimit the readLimit to set */ public void setReadLimit(long readLimit) { this.readLimit = readLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
@Override public void run() { if (!counter.monitorActive) { return; } long newLastTime = milliSecondFromNano(); counter.resetAccounting(newLastTime); for (PerChannel perChannel : trafficShapingHandler1.channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(newLastTime); } trafficShapingHandler1.doAccounting(counter); counter.scheduledFuture = counter.executor.schedule(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS); } }
/** * Change the underlying limitations. * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param newWriteLimit The new write limit (in bytes) * @param newReadLimit The new read limit (in bytes) */ public void configure(long newWriteLimit, long newReadLimit) { writeLimit = newWriteLimit; readLimit = newReadLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
/** * @param writeLimit Channel write limit */ public void setWriteChannelLimit(long writeLimit) { writeChannelLimit = writeLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
/** * @param readLimit Channel read limit */ public void setReadChannelLimit(long readLimit) { readChannelLimit = readLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
/** * @param newWriteLimit Channel write limit * @param newReadLimit Channel read limit */ public void configureChannel(long newWriteLimit, long newReadLimit) { writeChannelLimit = newWriteLimit; readChannelLimit = newReadLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
@Override public void run() { if (!monitorActive) { return; } resetAccounting(milliSecondFromNano()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(TrafficCounter.this); } scheduledFuture = executor.schedule(this, checkInterval.get(), TimeUnit.MILLISECONDS); } }
/** * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param writeLimit the writeLimit to set */ public void setWriteLimit(long writeLimit) { this.writeLimit = writeLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
@Override public void run() { if (!counter.monitorActive) { return; } long newLastTime = milliSecondFromNano(); counter.resetAccounting(newLastTime); for (PerChannel perChannel : trafficShapingHandler1.channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(newLastTime); } trafficShapingHandler1.doAccounting(counter); counter.scheduledFuture = counter.executor.schedule(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS); } }
/** * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param readLimit the readLimit to set */ public void setReadLimit(long readLimit) { this.readLimit = readLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
/** * Stop the monitoring process. */ public synchronized void stop() { if (!monitorActive) { return; } monitorActive = false; resetAccounting(milliSecondFromNano()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(this); } if (scheduledFuture != null) { scheduledFuture.cancel(true); } }
/** * Change the underlying limitations. * <p>Note the change will be taken as best effort, meaning * that all already scheduled traffics will not be * changed, but only applied to new traffics.</p> * <p>So the expected usage of this method is to be used not too often, * accordingly to the traffic shaping configuration.</p> * * @param newWriteLimit The new write limit (in bytes) * @param newReadLimit The new read limit (in bytes) */ public void configure(long newWriteLimit, long newReadLimit) { writeLimit = newWriteLimit; readLimit = newReadLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano()); } }
@Override public void run() { if (!monitorActive) { return; } resetAccounting(milliSecondFromNano()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(TrafficCounter.this); } scheduledFuture = executor.schedule(this, checkInterval.get(), TimeUnit.MILLISECONDS); } }
/** * Stop the monitoring process. */ public synchronized void stop() { if (!monitorActive) { return; } monitorActive = false; resetAccounting(milliSecondFromNano()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(this); } if (scheduledFuture != null) { scheduledFuture.cancel(true); } }
/** * @param writeLimit Channel write limit */ public void setWriteChannelLimit(long writeLimit) { writeChannelLimit = writeLimit; long now = TrafficCounter.milliSecondFromNano(); for (PerChannel perChannel : channelQueues.values()) { perChannel.channelTrafficCounter.resetAccounting(now); } }
@Override public void run() { if (!monitorActive) { return; } resetAccounting(milliSecondFromNano()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(TrafficCounter.this); } scheduledFuture = executor.schedule(this, checkInterval.get(), TimeUnit.MILLISECONDS); } }