* @param o The observed object.
*/
private synchronized MonitorNotification updateNotifications(
GaugeMonitorObservedObject o) {
MonitorNotification n = null;
// Send high notification if notifyHigh is true.
// Send low notification if notifyLow is true.
//
if (o.getStatus() == RISING_OR_FALLING) {
if (isFirstGreaterThanLast((Number)o.getDerivedGauge(),
highThreshold,
o.getType())) {
if (notifyHigh) {
n = new MonitorNotification(
THRESHOLD_HIGH_VALUE_EXCEEDED,
this,
0,
0,
"",
null,
null,
null,
highThreshold);
}
o.setStatus(FALLING);
} else if (isFirstGreaterThanLast(lowThreshold,
(Number)o.getDerivedGauge(),
o.getType())) {
if (notifyLow) {
n = new MonitorNotification(
THRESHOLD_LOW_VALUE_EXCEEDED,
this,
0,
0,
"",
null,
null,
null,
lowThreshold);
}
o.setStatus(RISING);
}
} else {
if (o.getStatus() == RISING) {
if (isFirstGreaterThanLast((Number)o.getDerivedGauge(),
highThreshold,
o.getType())) {
if (notifyHigh) {
n = new MonitorNotification(
THRESHOLD_HIGH_VALUE_EXCEEDED,
this,
0,
0,
"",
null,
null,
null,
highThreshold);
}
o.setStatus(FALLING);
}
} else if (o.getStatus() == FALLING) {
if (isFirstGreaterThanLast(lowThreshold,
(Number)o.getDerivedGauge(),
o.getType())) {
if (notifyLow) {
n = new MonitorNotification(
THRESHOLD_LOW_VALUE_EXCEEDED,
this,
0,
0,
"",