|
@@ -13,20 +13,13 @@ import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
|
|
public class DataCollector {
|
|
|
private static Map<Integer, DataCollector> collectors = new ConcurrentHashMap();
|
|
|
-
|
|
|
private Integer port;
|
|
|
-
|
|
|
private AtomicLong readBytes = new AtomicLong();
|
|
|
-
|
|
|
private AtomicLong wroteBytes = new AtomicLong();
|
|
|
-
|
|
|
private AtomicLong readMsgs = new AtomicLong();
|
|
|
-
|
|
|
private AtomicLong wroteMsgs = new AtomicLong();
|
|
|
-
|
|
|
private AtomicInteger channels = new AtomicInteger();
|
|
|
|
|
|
-
|
|
|
public static DataCollector getCollector(Integer port) {
|
|
|
DataCollector collector = (DataCollector) collectors.get(port);
|
|
|
if (null == collector) {
|
|
@@ -93,33 +86,21 @@ public class DataCollector {
|
|
|
public void incrementReadBytes(long bytes) {
|
|
|
this.readBytes.addAndGet(bytes);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public void incrementWroteBytes(long bytes) {
|
|
|
this.wroteBytes.addAndGet(bytes);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public void incrementReadMsgs(long msgs) {
|
|
|
this.readMsgs.addAndGet(msgs);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public void incrementWroteMsgs(long msgs) {
|
|
|
this.wroteMsgs.addAndGet(msgs);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public AtomicInteger getChannels() {
|
|
|
return this.channels;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public Integer getPort() {
|
|
|
return this.port;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
public void setPort(Integer port) {
|
|
|
this.port = port;
|
|
|
}
|