MonitorNotification.java revision 2362
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson/*
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This code is free software; you can redistribute it and/or modify it
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * under the terms of the GNU General Public License version 2 only, as
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * published by the Free Software Foundation. Oracle designates this
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * particular file as subject to the "Classpath" exception as provided
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * by Oracle in the LICENSE file that accompanied this code.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This code is distributed in the hope that it will be useful, but WITHOUT
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * version 2 for more details (a copy is included in the LICENSE file that
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * accompanied this code).
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * You should have received a copy of the GNU General Public License version
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * 2 along with this work; if not, write to the Free Software Foundation,
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * or visit www.oracle.com if you need additional information or have any
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * questions.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilsonpackage javax.management.monitor;
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson// jmx imports
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson//
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilsonimport javax.management.ObjectName;
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson/**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Provides definitions of the notifications sent by monitor MBeans.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <P>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * The notification source and a set of parameters concerning the monitor MBean's state
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * need to be specified when creating a new object of this class.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * The list of notifications fired by the monitor MBeans is the following:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>Common to all kind of monitors:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed object is not registered in the MBean server.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute is not contained in the observed object.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The type of the observed attribute is not correct.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>Any exception (except the cases described above) occurs when trying to get the value of the observed attribute.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>Common to the counter and the gauge monitors:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The threshold high or threshold low are not of the same type as the gauge (gauge monitors).
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The threshold or the offset or the modulus are not of the same type as the counter (counter monitors).
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>Counter monitors only:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute has reached the threshold value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>Gauge monitors only:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute has exceeded the threshold high value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute has exceeded the threshold low value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>String monitors only:
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute has matched the "string to compare" value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <LI>The observed attribute has differed from the "string to compare" value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * </UL>
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson *
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * @since 1.5
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilsonpublic class MonitorNotification extends javax.management.Notification {
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /*
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * ------------------------------------------
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * PUBLIC VARIABLES
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * ------------------------------------------
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed object is not registered in the MBean server.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is fired by all kinds of monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.error.mbean</CODE>.
8d7126a8f999e88851c7dd851a17c27cb6d2ec3fneil_a_wilson */
8d7126a8f999e88851c7dd851a17c27cb6d2ec3fneil_a_wilson public static final String OBSERVED_OBJECT_ERROR = "jmx.monitor.error.mbean";
8d7126a8f999e88851c7dd851a17c27cb6d2ec3fneil_a_wilson
8d7126a8f999e88851c7dd851a17c27cb6d2ec3fneil_a_wilson /**
8d7126a8f999e88851c7dd851a17c27cb6d2ec3fneil_a_wilson * Notification type denoting that the observed attribute is not contained in the observed object.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is fired by all kinds of monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.error.attribute</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String OBSERVED_ATTRIBUTE_ERROR = "jmx.monitor.error.attribute";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the type of the observed attribute is not correct.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is fired by all kinds of monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.error.type</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String OBSERVED_ATTRIBUTE_TYPE_ERROR = "jmx.monitor.error.type";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the type of the thresholds, offset or modulus is not correct.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is fired by counter and gauge monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.error.threshold</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String THRESHOLD_ERROR = "jmx.monitor.error.threshold";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that a non-predefined error type has occurred when trying to get the value of the observed attribute.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is fired by all kinds of monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.error.runtime</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String RUNTIME_ERROR = "jmx.monitor.error.runtime";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed attribute has reached the threshold value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is only fired by counter monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.counter.threshold</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String THRESHOLD_VALUE_EXCEEDED = "jmx.monitor.counter.threshold";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed attribute has exceeded the threshold high value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is only fired by gauge monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.high</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String THRESHOLD_HIGH_VALUE_EXCEEDED = "jmx.monitor.gauge.high";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed attribute has exceeded the threshold low value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is only fired by gauge monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.gauge.low</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String THRESHOLD_LOW_VALUE_EXCEEDED = "jmx.monitor.gauge.low";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed attribute has matched the "string to compare" value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is only fired by string monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.string.matches</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String STRING_TO_COMPARE_VALUE_MATCHED = "jmx.monitor.string.matches";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /**
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * Notification type denoting that the observed attribute has differed from the "string to compare" value.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * This notification is only fired by string monitors.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * <BR>The value of this notification type is <CODE>jmx.monitor.string.differs</CODE>.
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson public static final String STRING_TO_COMPARE_VALUE_DIFFERED = "jmx.monitor.string.differs";
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson /*
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * ------------------------------------------
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * PRIVATE VARIABLES
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson * ------------------------------------------
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson */
ff7911bf4b588374a79cb2e4b03c4283b9a10376neil_a_wilson
/* Serial version */
private static final long serialVersionUID = -4608189663661929204L;
/**
* @serial Monitor notification observed object.
*/
private ObjectName observedObject = null;
/**
* @serial Monitor notification observed attribute.
*/
private String observedAttribute = null;
/**
* @serial Monitor notification derived gauge.
*/
private Object derivedGauge = null;
/**
* @serial Monitor notification release mechanism.
* This value is used to keep the threshold/string (depending on the
* monitor type) that triggered off this notification.
*/
private Object trigger = null;
/*
* ------------------------------------------
* CONSTRUCTORS
* ------------------------------------------
*/
/**
* Creates a monitor notification object.
*
* @param type The notification type.
* @param source The notification producer.
* @param sequenceNumber The notification sequence number within the source object.
* @param timeStamp The notification emission date.
* @param msg The notification message.
* @param obsObj The object observed by the producer of this notification.
* @param obsAtt The attribute observed by the producer of this notification.
* @param derGauge The derived gauge.
* @param trigger The threshold/string (depending on the monitor type) that triggered the notification.
*/
MonitorNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg,
ObjectName obsObj, String obsAtt, Object derGauge, Object trigger) {
super(type, source, sequenceNumber, timeStamp, msg);
this.observedObject = obsObj;
this.observedAttribute = obsAtt;
this.derivedGauge = derGauge;
this.trigger = trigger;
}
/*
* ------------------------------------------
* PUBLIC METHODS
* ------------------------------------------
*/
// GETTERS AND SETTERS
//--------------------
/**
* Gets the observed object of this monitor notification.
*
* @return The observed object.
*/
public ObjectName getObservedObject() {
return observedObject;
}
/**
* Gets the observed attribute of this monitor notification.
*
* @return The observed attribute.
*/
public String getObservedAttribute() {
return observedAttribute;
}
/**
* Gets the derived gauge of this monitor notification.
*
* @return The derived gauge.
*/
public Object getDerivedGauge() {
return derivedGauge;
}
/**
* Gets the threshold/string (depending on the monitor type) that triggered off this monitor notification.
*
* @return The trigger.
*/
public Object getTrigger() {
return trigger;
}
}