01: package org.objectweb.celtix.bus.management.counters;
02:
03: public class TransportServerCounters {
04: private static final String[] COUNTER_NAMES = { "RequestsTotal",
05: "RequestsOneWay", "TotalError" };
06: private Counter[] counters;
07:
08: private String owner;
09:
10: public TransportServerCounters(String o) {
11: owner = o;
12: counters = new Counter[COUNTER_NAMES.length];
13: initCounters();
14: }
15:
16: public String getOwner() {
17: return owner;
18: }
19:
20: public Counter getRequestTotal() {
21: return counters[0];
22: }
23:
24: public Counter getRequestOneWay() {
25: return counters[1];
26: }
27:
28: public Counter getTotalError() {
29: return counters[2];
30:
31: }
32:
33: private void initCounters() {
34: for (int i = 0; i < COUNTER_NAMES.length; i++) {
35: Counter c = new Counter(COUNTER_NAMES[i]);
36: counters[i] = c;
37: }
38: }
39:
40: public void resetCounters() {
41: for (int i = 0; i < counters.length; i++) {
42: counters[i].reset();
43: }
44: }
45:
46: public void stopCounters() {
47: for (int i = 0; i < counters.length; i++) {
48: counters[i].stop();
49: }
50: }
51:
52: }
|