@ChannelHandler.Sharable public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler
AbstractTrafficShapingHandler
is for global
traffic shaping, that is to say a global limitation of the bandwidth, whatever
the number of opened channels.release()
once this handler is not needed anymore to release all internal resources.
This will not shutdown the EventExecutor
as it may be shared, so you need to do this by your own.ChannelHandler.Sharable
checkInterval, DEFAULT_CHECK_INTERVAL, trafficCounter
Constructor and Description |
---|
GlobalTrafficShapingHandler(EventExecutor executor)
Create a new instance
|
GlobalTrafficShapingHandler(ScheduledExecutorService executor,
long checkInterval)
Create a new instance
|
GlobalTrafficShapingHandler(ScheduledExecutorService executor,
long writeLimit,
long readLimit)
Create a new instance
|
GlobalTrafficShapingHandler(ScheduledExecutorService executor,
long writeLimit,
long readLimit,
long checkInterval)
Create a new instance
|
Modifier and Type | Method and Description |
---|---|
void |
release()
Release all internal resources of this instance
|
calculateSize, channelRead, configure, configure, configure, doAccounting, read, toString, trafficCounter, write
bind, close, connect, deregister, disconnect, flush
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public GlobalTrafficShapingHandler(ScheduledExecutorService executor, long writeLimit, long readLimit, long checkInterval)
executor
- the ScheduledExecutorService
to use for the TrafficCounter
writeLimit
- 0 or a limit in bytes/sreadLimit
- 0 or a limit in bytes/scheckInterval
- The delay between two computations of performances for
channels or 0 if no stats are to be computedpublic GlobalTrafficShapingHandler(ScheduledExecutorService executor, long writeLimit, long readLimit)
executor
- the ScheduledExecutorService
to use for the TrafficCounter
writeLimit
- 0 or a limit in bytes/sreadLimit
- 0 or a limit in bytes/spublic GlobalTrafficShapingHandler(ScheduledExecutorService executor, long checkInterval)
executor
- the ScheduledExecutorService
to use for the TrafficCounter
checkInterval
- The delay between two computations of performances for
channels or 0 if no stats are to be computedpublic GlobalTrafficShapingHandler(EventExecutor executor)
executor
- the ScheduledExecutorService
to use for the TrafficCounter
Copyright © 2008–2018 The Netty Project. All rights reserved.