Fix overriden method not called in TrafficShaping

Motivation:
handlerAdded and handlerRemoved were overriden but super was never
called, while it should.
Also add one missing information in the toString method.

Modifications:
Add the super corresponding call, and add checkInterval to the
toString() method

Result;
super method calls are correctly passed to the super implementation
part.
This commit is contained in:
Frederic Bregier 2014-09-20 19:07:23 +02:00 committed by Norman Maurer
parent bf1de1da4d
commit eaaa439c67
3 changed files with 7 additions and 3 deletions

View File

@ -411,9 +411,9 @@ public abstract class AbstractTrafficShapingHandler extends ChannelHandlerAdapte
@Override @Override
public String toString() { public String toString() {
return "TrafficShaping with Write Limit: " + writeLimit + return "TrafficShaping with Write Limit: " + writeLimit + " Read Limit: " + readLimit +
" Read Limit: " + readLimit + " and Counter: " + " CheckInterval: " + checkInterval + " and Counter: "
(trafficCounter != null? trafficCounter.toString() : "none"); + (trafficCounter != null ? trafficCounter.toString() : "none");
} }
/** /**

View File

@ -117,6 +117,7 @@ public class ChannelTrafficShapingHandler extends AbstractTrafficShapingHandler
ctx.channel().hashCode(), checkInterval); ctx.channel().hashCode(), checkInterval);
setTrafficCounter(trafficCounter); setTrafficCounter(trafficCounter);
trafficCounter.start(); trafficCounter.start();
super.handlerAdded(ctx);
} }
@Override @Override
@ -130,6 +131,7 @@ public class ChannelTrafficShapingHandler extends AbstractTrafficShapingHandler
} }
} }
messagesQueue.clear(); messagesQueue.clear();
super.handlerRemoved(ctx);
} }
private static final class ToSend { private static final class ToSend {

View File

@ -172,6 +172,7 @@ public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler {
Integer key = ctx.channel().hashCode(); Integer key = ctx.channel().hashCode();
List<ToSend> mq = new LinkedList<ToSend>(); List<ToSend> mq = new LinkedList<ToSend>();
messagesQueues.put(key, mq); messagesQueues.put(key, mq);
super.handlerAdded(ctx);
} }
@Override @Override
@ -186,6 +187,7 @@ public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler {
} }
mq.clear(); mq.clear();
} }
super.handlerRemoved(ctx);
} }
private static final class ToSend { private static final class ToSend {