From 66f645cd55ef17587c47490434dada8b4d7dab36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Br=C3=A9gier?= Date: Fri, 20 Mar 2009 17:52:43 +0000 Subject: [PATCH] Fix doc --- .../handler/trafficshaping/package-info.java | 67 ++++++++++--------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/trafficshaping/package-info.java b/src/main/java/org/jboss/netty/handler/trafficshaping/package-info.java index 8691271775..8386f80721 100644 --- a/src/main/java/org/jboss/netty/handler/trafficshaping/package-info.java +++ b/src/main/java/org/jboss/netty/handler/trafficshaping/package-info.java @@ -28,21 +28,22 @@ * *

The main goal of this package is to allow to shape the traffic (bandwidth limitation), * but also to get statistics on how many bytes are read or written. Both functions can - * be active or inactive (traffic or statistics).




+ * be active or inactive (traffic or statistics).

* - *

Three classes implement this behavior:

+ *

Three classes implement this behavior:
*

+ * + *

Standard use could be as follow:

+ * + *



* - *

Standard use could be as follow:



- * - *

To activate or deactivate the traffic shaping, change the value corresponding to your desire as - * [Global or per Channel] [Write or Read] Limitation in byte/s.


- *

PerformanceCounterFactory.NO_LIMIT (-1) - * stands for no limitation, so the traffic shaping is deactivate (on what you specified).


- *

You can either change those values with the method changeConfiguration in PerformanceCounterFactory or - * directly from the PerformanceCounter method changeConfiguration.


- *

- * - *

To activate or deactivate the statistics, you can adjust the delay to a low (not less than 200ms - * for efficiency reasons) or a high value (let say 24H in ms is huge enough to not get the problem) - * or even using PerformanceCounterFactory.NO_STAT (-1).


- *

And if you don't want to do anything with this statistics, just implement an empty method for - * PerformanceCounterFactory.accounting(PerformanceCounter).


- *

Again this can be changed either from PerformanceCounterFactory or directly in PerformanceCounter.




- * - *

You can also completely deactivate channel or global PerformanceCounter by setting the boolean to false - * accordingly to your needs in the PerformanceCounterFactory. It will deactivate the global Monitor. For channels monitor, - * it will prevent new monitors to be created (or reversely they will be created for newly connected channels).




- * - *

So in your application you will create your own PerformanceCounterFactory and setting the values to fit your needs.



+ *

So in your application you will create your own PerformanceCounterFactory and setting the values to fit your needs.

* MyPerformanceCounterFactory myFactory = new MyPerformanceCounter(...);


*

Then you can create your pipeline (using a PipelineFactory since each TrafficShapingHandler must be unique by channel) and adding this handler before - * your MemoryAwareThreadPoolExecutor:



+ * your MemoryAwareThreadPoolExecutor:

* pipeline.addLast("MyTrafficShaping",new MyTrafficShapingHandler(myFactory));
* ...
- * pipeline.addLast("MemoryExecutor",new ExecutionHandler(memoryAwareThreadPoolExecutor));


+ * pipeline.addLast("MemoryExecutor",new ExecutionHandler(memoryAwareThreadPoolExecutor));

* *

TrafficShapingHandler must be unique by channel but however it is still global due to - * the PerformanceCounterFactcory that is shared between all handlers across the channels.



+ * the PerformanceCounterFactcory that is shared between all handlers across the channels.

* * *