From a1a60ec5b6d585e1503061f8435be27fd269d5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Br=C3=A9gier?= Date: Fri, 18 May 2012 15:23:11 +0300 Subject: [PATCH] Add support for ObjectSizeEstimator --- .../traffic/GlobalTrafficShapingHandler.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java b/handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java index 73fc97df6d..dc9a6d2091 100644 --- a/handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java +++ b/handler/src/main/java/io/netty/handler/traffic/GlobalTrafficShapingHandler.java @@ -21,6 +21,7 @@ import io.netty.channel.ChannelHandler.Sharable; import io.netty.handler.execution.ExecutionHandler; import io.netty.handler.execution.MemoryAwareThreadPoolExecutor; import io.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; +import org.jboss.netty.util.ObjectSizeEstimator; /** * This implementation of the {@link AbstractTrafficShapingHandler} is for global @@ -91,4 +92,68 @@ public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler { super(executor, writeLimit, readLimit); createGlobalTrafficCounter(); } + /** + * @param executor + * @param checkInterval + */ + public GlobalTrafficShapingHandler(Executor executor, long checkInterval) { + super(executor, checkInterval); + createGlobalTrafficCounter(); + } + + /** + * @param executor + */ + public GlobalTrafficShapingHandler(Executor executor) { + super(executor); + createGlobalTrafficCounter(); + } + + /** + * @param objectSizeEstimator + * @param executor + * @param writeLimit + * @param readLimit + * @param checkInterval + */ + public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, + Executor executor, long writeLimit, long readLimit, + long checkInterval) { + super(objectSizeEstimator, executor, writeLimit, readLimit, + checkInterval); + createGlobalTrafficCounter(); + } + + /** + * @param objectSizeEstimator + * @param executor + * @param writeLimit + * @param readLimit + */ + public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, + Executor executor, long writeLimit, long readLimit) { + super(objectSizeEstimator, executor, writeLimit, readLimit); + createGlobalTrafficCounter(); + } + + /** + * @param objectSizeEstimator + * @param executor + * @param checkInterval + */ + public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, + Executor executor, long checkInterval) { + super(objectSizeEstimator, executor, checkInterval); + createGlobalTrafficCounter(); + } + + /** + * @param objectSizeEstimator + * @param executor + */ + public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, + Executor executor) { + super(objectSizeEstimator, executor); + createGlobalTrafficCounter(); + } }