下面列出了javax.management.monitor.GaugeMonitor#stop ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Wait for granularity period (multiplied by 2 for sure)
//
Thread.sleep(granularityperiod * 2);
// Check if notification was received
//
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Wait for granularity period (multiplied by 2 for sure)
//
Thread.sleep(granularityperiod * 2);
// Check if notification was received
//
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Check if notification was received
//
doWait();
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}
/**
* Update the gauge and check for notifications
*/
public int gaugeMonitorNotification() throws Exception {
GaugeMonitor gaugeMonitor = new GaugeMonitor();
try {
// Create a new GaugeMonitor MBean and add it to the MBeanServer.
//
echo(">>> CREATE a new GaugeMonitor MBean");
ObjectName gaugeMonitorName = new ObjectName(
domain + ":type=" + GaugeMonitor.class.getName());
server.registerMBean(gaugeMonitor, gaugeMonitorName);
echo(">>> ADD a listener to the GaugeMonitor");
gaugeMonitor.addNotificationListener(this, null, null);
//
// MANAGEMENT OF A STANDARD MBEAN
//
echo(">>> SET the attributes of the GaugeMonitor:");
gaugeMonitor.addObservedObject(obsObjName);
echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName);
gaugeMonitor.setObservedAttribute("IntegerAttribute");
echo("\tATTRIBUTE \"ObservedAttribute\" = IntegerAttribute");
gaugeMonitor.setNotifyLow(false);
gaugeMonitor.setNotifyHigh(false);
echo("\tATTRIBUTE \"Notify Low Flag\" = false");
echo("\tATTRIBUTE \"Notify High Flag\" = false");
Integer highThreshold = 3, lowThreshold = 2;
gaugeMonitor.setThresholds(highThreshold, lowThreshold);
echo("\tATTRIBUTE \"Low Threshold\" = " + lowThreshold);
echo("\tATTRIBUTE \"High Threshold\" = " + highThreshold);
int granularityperiod = 500;
gaugeMonitor.setGranularityPeriod(granularityperiod);
echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod);
echo(">>> START the GaugeMonitor");
gaugeMonitor.start();
// Wait for granularity period (multiplied by 2 for sure)
//
Thread.sleep(granularityperiod * 2);
// Check if notification was received
//
if (messageReceived) {
echo("\tOK: GaugeMonitor got RUNTIME_ERROR notification!");
} else {
echo("\tKO: GaugeMonitor did not get " +
"RUNTIME_ERROR notification!");
return 1;
}
} finally {
messageReceived = false;
if (gaugeMonitor != null)
gaugeMonitor.stop();
}
return 0;
}