public final class AlarmNotification extends Notification implements VendorExtensions
AlarmMBean
to indicate that
some component or subsystem in the SLEE is experiencing a problem. Typically, a
SLEE component uses the AlarmFacility
to manage alarms.
Alarm notifications contain a NotificationSource
object that can be used
to obtain more information about the object that raised the alarm. The type of
an alarm notification can be used to infer the type of the notification source
object contained in the notification:
Notification.getType()
== SbbNotification.ALARM_NOTIFICATION_TYPE
then the type of the notification source object is SbbNotification
.
Notification.getType()
== ResourceAdaptorEntityNotification.ALARM_NOTIFICATION_TYPE
then the type of the notification source object is ResourceAdaptorEntityNotification
.
Notification.getType()
== ProfileTableNotification.ALARM_NOTIFICATION_TYPE
then the type of the notification source object is ProfileTableNotification
.
Notification.getType()
== SubsystemNotification.ALARM_NOTIFICATION_TYPE
then the type of the notification source object is SubsystemNotification
.
As of SLEE 1.1, serialization of this class has been modified to take into account cause
Throwable
objects that may not be deserializable client-side due to classloader
issues. For example, if the cause of an alarm is an object of a custom exception
class included in the deployable unit of a component, a generic client may not have
that class available in its classpath or be able to load it via Java's remote class loading
mechanisms (eg. the codebase URL could be a file://
URL on a different host
that cannot be resolved on the client host). Serialization of an AlarmNotification
object containing a cause now includes the stack trace of that cause in the serialization
stream. If the cause Throwable
cannot be later deserialized with the
AlarmNotification
object, a generic java.lang.Exception
with a message containing the original stack trace is returned as the alarm's cause
instead.
source
Constructor and Description |
---|
AlarmNotification(AlarmMBean alarmMBean,
String alarmType,
Object alarmSource,
Level alarmLevel,
String message,
Throwable cause,
long sequenceNumber,
long timestamp)
Deprecated.
Alarm notifications have been expanded with new attributes to take advantage
of the new features provided by the SLEE specification. The
AlarmNotification(String,AlarmMBean,String,NotificationSource,String,String,AlarmLevel,String,Throwable,long,long)
constructor should be used instead of this constructor. |
AlarmNotification(String type,
AlarmMBean alarmMBean,
String alarmID,
NotificationSource notificationSource,
String alarmType,
String instanceID,
AlarmLevel alarmLevel,
String message,
Throwable cause,
long sequenceNumber,
long timestamp)
Create an
AlarmNotification to notify listeners of an alarm. |
Modifier and Type | Method and Description |
---|---|
static void |
disableVendorDataDeserialization()
Disable the deserialization of vendor-specific data for objects of this class.
|
static void |
disableVendorDataSerialization()
Disable the serialization of vendor-specific data for objects of this class.
|
static void |
enableVendorDataDeserialization()
Enable the deserialization of vendor-specific data for objects of this class.
|
static void |
enableVendorDataSerialization()
Enable the serialization of vendor-specific data for objects of this class.
|
boolean |
equals(Object obj)
Compare this notification for equality with another object.
|
String |
getAlarmID()
Get the unique alarm identifier of the alarm.
|
AlarmLevel |
getAlarmLevel()
Get the alarm level of the alarm notification.
|
Object |
getAlarmSource()
Deprecated.
Replaced with
getNotificationSource() . |
String |
getAlarmType()
Get the type of the alarm.
|
Throwable |
getCause()
Get the cause for the alarm.
|
String |
getInstanceID()
Get the instance identifier of the alarm type.
|
Level |
getLevel()
Deprecated.
Trace and alarm levels have been split into different classes.
Replaced with
getAlarmLevel() . |
NotificationSource |
getNotificationSource()
Get the object that identifies the component or subsystem in the SLEE that
raised the alarm.
|
Object |
getVendorData()
Get the vendor-specific data.
|
int |
hashCode()
Get a hash code value for this notification.
|
void |
setVendorData(Object vendorData)
Set the vendor-specific data.
|
String |
toString()
Get a string representation for this notification.
|
getMessage, getSequenceNumber, getTimeStamp, getType, getUserData, setSequenceNumber, setSource, setTimeStamp, setUserData
getSource
public AlarmNotification(AlarmMBean alarmMBean, String alarmType, Object alarmSource, Level alarmLevel, String message, Throwable cause, long sequenceNumber, long timestamp) throws NullPointerException, IllegalArgumentException
AlarmNotification(String,AlarmMBean,String,NotificationSource,String,String,AlarmLevel,String,Throwable,long,long)
constructor should be used instead of this constructor.AlarmNotification
to notify listeners of a alarm.alarmMBean
- the AlarmMBean
object that is emitting
this notification.alarmType
- the type of the alarm being generated. Typically a management client
should be able to infer the type of the alarmSource
object by
inspecting this type.alarmSource
- an object that identifies the object that generated the alarm, for
example an SbbID
.alarmLevel
- the alarm level.message
- the alarm message.cause
- an optional cause for the alarm.sequenceNumber
- the notification sequence number within the source
AlarmMBean
object.timestamp
- the time (in ms since January 1, 1970 UTC) that the alarm was generated.NullPointerException
- if notificationSource
, alarmType
,
alarmLevel
, or message
is null
.IllegalArgumentException
- if alarmLevel ==
Level.OFF
.public AlarmNotification(String type, AlarmMBean alarmMBean, String alarmID, NotificationSource notificationSource, String alarmType, String instanceID, AlarmLevel alarmLevel, String message, Throwable cause, long sequenceNumber, long timestamp) throws NullPointerException
AlarmNotification
to notify listeners of an alarm.type
- the JMX type of the notification. The type of the notification
is typically obtained from the NotificationSource
parameter
when this notification object is created, and can be used by notification
listeners to infer the type of the NotificationSource
and
hence obtain further information about the source of the notification.alarmMBean
- the AlarmMBean
object that is emitting this
notification.alarmID
- the unique alarm identifier for the alarm.notificationSource
- the component or subsystem in the SLEE that raised
the alarm.alarmType
- an identifier specifying the type of the alarm.instanceID
- an identifier specifying the particular instance of the
alarm type that is occurring.alarmLevel
- the alarm level of the notification. This could be AlarmLevel.CLEAR
if the alarm has been cleared.message
- the alarm message.cause
- an optional cause for the alarm notification.sequenceNumber
- the notification sequence number within the source
AlarmMBean
object.timestamp
- the time (in ms since January 1, 1970 UTC) that the alarm was raised,
updated, or cleared.NullPointerException
- if type
, alarmMBean
,
alarmID
, notificationSource
, alarmType
,
instanceID
, alarmLevel
, or message
is null
.public String getAlarmID()
null
for
SLEE 1.0-compliant notifications.public NotificationSource getNotificationSource()
null
for SLEE 1.0-compliant
notifications.public String getAlarmType()
public Object getAlarmSource()
getNotificationSource()
.getNotificationSource()
for SLEE 1.1-compliant notifications.public String getInstanceID()
null
for SLEE 1.0-compliant
notifications.public Level getLevel()
getAlarmLevel()
.Level.INFO
for SLEE 1.1-compliant notifications.public AlarmLevel getAlarmLevel()
null
for SLEE 1.0-compliant
notifications.public Throwable getCause()
For SLEE 1.1-compliant notifications, this method returns the cause provided when the alarm was raised. For SLEE 1.0-compliant notifications, this method returns the cause provided when the alarm notification was generated.
null
if no cause was
provided.public static void enableVendorDataSerialization()
By default, any vendor-specific data included in an object of this class will not be included in the serialization stream when the object is serialized. Invoking this method changes this behavior so that vendor-specific data is included in the serialization stream when an object of this class is serialized.
This method should only be invoked if the vendor-specific data is serializable via standard Java serialization means.
disableVendorDataSerialization()
,
setVendorData(java.lang.Object)
public static void disableVendorDataSerialization()
If the serialization of vendor-specific data for objects of this class has
been enabled via the enableVendorDataSerialization()
method, this
method disables that behavior again.
public static void enableVendorDataDeserialization()
By default, any vendor-specific data included in the serialization stream of objects of this class is discarded upon deserialization. Invoking this method changes that behavior so that the vendor-specific data is also deserialized when an object of this class is deserialized. A management client that enables the deserialization of vendor-specific data must ensure that any necessary classes required to deserialize that data is available in the relevant classloader.
disableVendorDataDeserialization()
,
getVendorData()
public static void disableVendorDataDeserialization()
If the deserialization of vendor-specific data for objects of this class has
been enabled via the enableVendorDataDeserialization()
method, this
method disables that behavior again.
public void setVendorData(Object vendorData)
setVendorData
in interface VendorExtensions
vendorData
- the vendor-specific data.public Object getVendorData()
getVendorData
in interface VendorExtensions
public boolean equals(Object obj)
For backwards compatibility, this method performs either a SLEE 1.0-based comparison or a SLEE 1.1-based comparison based on the state of this notification object. If this notification contains a non-null alarm source reference, a SLEE 1.0-based comparison is performed, using the SLEE 1.0 alarm levels. Otherwise, a SLEE 1.1-based comparison is performed using the SLEE 1.1 alarm levels.
The SLEE 1.0-based comparison considers two notifications to be equal if obj
is an instance of this class and the alarm type, alarm source, SLEE 1.0 alarm level, and
message attributes of obj
are the same as the corresponding attributes of
this
.
The SLEE 1.1-based comparison considers two notifications to be equal if obj
if an instance of this class and the alarm identifier, notification source, alarm type,
alarm instance ID, SLEE 1.1 alarm level, and message attributes of obj
are
the same as the corresponding attributes of this
.
Note that a SLEE 1.0-compliant alarm notification can never be equal to a SLEE 1.1-compliant alarm notification.
public int hashCode()
public String toString()
toString
in class Notification