01: package com.jamonapi;
02:
03: /**
04: * Class used to track the number of active monitors (including global/primary/this).
05: * It allows you to see how many monitors are concurrently running at any given time.
06: *
07: * @author ssouza
08: */
09:
10: final class ActivityStats {
11:
12: final Counter allActive; // the number of monitors that are now running
13: final Counter primaryActive; // the number of monitors marked primary that are now running
14: final Counter this Active; // the number of monitors of this type that are running
15:
16: /** Creates a new instance of Counters */
17: ActivityStats(Counter this Active, Counter primaryActive,
18: Counter allActive) {
19: this .this Active = this Active;
20: this .primaryActive = primaryActive;
21: this .allActive = allActive;
22: }
23:
24: ActivityStats() {
25: this (new Counter(), new Counter(), new Counter());
26: }
27:
28: /** The number of all active monitors running */
29: public double getGlobalActive() {
30: return allActive.getCount();
31: }
32:
33: /** The number of primary monitors running */
34: public double getPrimaryActive() {
35: return primaryActive.getCount();
36: }
37:
38: /** The number monitors of this type that are running */
39: public double getActive() {
40: return thisActive.getCount();
41: }
42:
43: }
|