51
52 // granularity period
53 private int granularityperiod = 10;
54
55 // derived gauge
56 private volatile int derivedGauge = 2;
57
58 // flag to notify that a message has been received
59 private volatile boolean messageReceived = false;
60
61 private volatile Object observedValue = null;
62
63 // MBean class
64 public class StdObservedObject implements StdObservedObjectMBean {
65 public Object getNbObjects() {
66 echo(">>> StdObservedObject.getNbObjects: " + count);
67 synchronized(CounterMonitorTest.class) {
68 observedValue = count;
69 CounterMonitorTest.class.notifyAll();
70 }
71 return count;
72 }
73 public void setNbObjects(Object n) {
74 echo(">>> StdObservedObject.setNbObjects: " + n);
75 count = n;
76 }
77 private volatile Object count= null;
78 }
79
80 // MBean interface
81 public interface StdObservedObjectMBean {
82 public Object getNbObjects();
83 public void setNbObjects(Object n);
84 }
85
86 // Notification handler
87 public void handleNotification(Notification notification,
88 Object handback) {
89 MonitorNotification n = (MonitorNotification) notification;
90 echo("\tInside handleNotification...");
91 String type = n.getType();
|
51
52 // granularity period
53 private int granularityperiod = 10;
54
55 // derived gauge
56 private volatile int derivedGauge = 2;
57
58 // flag to notify that a message has been received
59 private volatile boolean messageReceived = false;
60
61 private volatile Object observedValue = null;
62
63 // MBean class
64 public class StdObservedObject implements StdObservedObjectMBean {
65 public Object getNbObjects() {
66 echo(">>> StdObservedObject.getNbObjects: " + count);
67 synchronized(CounterMonitorTest.class) {
68 observedValue = count;
69 CounterMonitorTest.class.notifyAll();
70 }
71 return observedValue;
72 }
73 public void setNbObjects(Object n) {
74 echo(">>> StdObservedObject.setNbObjects: " + n);
75 count = n;
76 }
77 private volatile Object count= null;
78 }
79
80 // MBean interface
81 public interface StdObservedObjectMBean {
82 public Object getNbObjects();
83 public void setNbObjects(Object n);
84 }
85
86 // Notification handler
87 public void handleNotification(Notification notification,
88 Object handback) {
89 MonitorNotification n = (MonitorNotification) notification;
90 echo("\tInside handleNotification...");
91 String type = n.getType();
|