1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.waarp.ftp.core.config;
19
20 import java.util.concurrent.ScheduledExecutorService;
21
22 import org.waarp.common.file.DataBlock;
23
24 import io.netty.handler.traffic.GlobalChannelTrafficShapingHandler;
25
26
27
28
29
30
31 public class FtpGlobalTrafficShapingHandler extends GlobalChannelTrafficShapingHandler {
32
33 public FtpGlobalTrafficShapingHandler(ScheduledExecutorService executor, long writeGlobalLimit,
34 long readGlobalLimit, long writeChannelLimit, long readChannelLimit, long checkInterval, long maxTime) {
35 super(executor, writeGlobalLimit, readGlobalLimit, writeChannelLimit, readChannelLimit, checkInterval, maxTime);
36 }
37
38 public FtpGlobalTrafficShapingHandler(ScheduledExecutorService executor, long writeGlobalLimit,
39 long readGlobalLimit, long writeChannelLimit, long readChannelLimit, long checkInterval) {
40 super(executor, writeGlobalLimit, readGlobalLimit, writeChannelLimit, readChannelLimit, checkInterval);
41 }
42
43 public FtpGlobalTrafficShapingHandler(ScheduledExecutorService executor, long writeGlobalLimit,
44 long readGlobalLimit, long writeChannelLimit, long readChannelLimit) {
45 super(executor, writeGlobalLimit, readGlobalLimit, writeChannelLimit, readChannelLimit);
46 }
47
48 public FtpGlobalTrafficShapingHandler(ScheduledExecutorService executor, long checkInterval) {
49 super(executor, checkInterval);
50 }
51
52 public FtpGlobalTrafficShapingHandler(ScheduledExecutorService executor) {
53 super(executor);
54 }
55
56 @Override
57 protected long calculateSize(Object msg) {
58 if (msg instanceof DataBlock) {
59 return ((DataBlock) msg).getByteCount();
60 }
61 return super.calculateSize(msg);
62 }
63
64 }