Top Description Fields Constructors Methods
javax.management

public Class Notification

extends EventObject
Class Inheritance
Known Direct Subclasses
javax.management.monitor.MonitorNotification, javax.management.relation.RelationNotification, javax.management.remote.JMXConnectionNotification, javax.management.timer.TimerAlarmClockNotification, javax.management.timer.TimerNotification, javax.management.AttributeChangeNotification, javax.management.MBeanServerNotification
Annotations
@SuppressWarnings:serial
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .ObjectStreamField, java.util.EventObject, java.security.AccessController, com.sun.jmx.mbeanserver.GetPropertyAction

The Notification class represents a notification emitted by an MBean. It contains a reference to the source MBean: if the notification has been forwarded through the MBean server, and the original source of the notification was a reference to the emitting MBean object, then the MBean server replaces it by the MBean's ObjectName. If the listener has registered directly with the MBean, this is either the object name or a direct reference to the MBean.

It is strongly recommended that notification senders use the object name rather than a reference to the MBean object as the source.

The serialVersionUID of this class is -7516092053498031989L.

Since
1.5

Field Summary

Modifier and TypeField and Description
private static boolean
private String
private static final ObjectStreamField[]
private static final long
private static final ObjectStreamField[]
private static final long
private long
private static final ObjectStreamField[]
private static final long
protected Object
source

Hides java.util.EventObject.source.

This field hides the EventObject#source field in the parent class to make it non-transient and therefore part of the serialized form.

private long
private String
private Object

Constructor Summary

AccessConstructor and Description
public
Notification(String
The notification type.
type
,
Object
The notification source.
source
,
long
The notification sequence number within the source object.
sequenceNumber
)

Creates a Notification object.

public
Notification(String
The notification type.
type
,
Object
The notification source.
source
,
long
The notification sequence number within the source object.
sequenceNumber
,
String
The detailed message.
message
)

Creates a Notification object.

public
Notification(String
The notification type.
type
,
Object
The notification source.
source
,
long
The notification sequence number within the source object.
sequenceNumber
,
long
The notification emission date.
timeStamp
)

Creates a Notification object.

public
Notification(String
The notification type.
type
,
Object
The notification source.
source
,
long
The notification sequence number within the source object.
sequenceNumber
,
long
The notification emission date.
timeStamp
,
String
The detailed message.
message
)

Creates a Notification object.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The message string of this notification object.
getMessage
()

Get the notification message.

public long

Returns:

The notification sequence number within the source object. It's a serial number identifying a particular instance of notification in the context of the notification source. The notification model does not assume that notifications will be received in the same order that they are sent. The sequence number helps listeners to sort received notifications.
getSequenceNumber
()

Get the notification sequence number.

public long

Returns:

The notification timestamp.
getTimeStamp
()

Get the notification timestamp.

public String

Returns:

The notification type. It's a string expressed in a dot notation similar to Java properties. It is recommended that the notification type should follow the reverse-domain-name convention used by Java package names. An example of a notification type is com.example.alarm.router.
getType
()

Get the notification type.

public Object

Returns:

The user data object. It is used for whatever data the notification source wishes to communicate to its consumers.
getUserData
()

Get the user data.

private void
public void
setSequenceNumber(long
The notification sequence number within the source object. It is a serial number identifying a particular instance of notification in the context of the notification source.
sequenceNumber
)

Set the notification sequence number.

public void
setSource(Object
the new source for this object.
source
)

Sets the source.

public void
setTimeStamp(long
The notification timestamp. It indicates when the notification was generated.
timeStamp
)

Set the notification timestamp.

public void
setUserData(Object
The user data object. It is used for whatever data the notification source wishes to communicate to its consumers.
userData
)

Set the user data.

public String

Returns:

A String representation of this notification.
toString
()

Overrides java.util.EventObject.toString.

Returns a String representation of this notification.
private void
Inherited from java.util.EventObject:
getSource

Field Detail

compatback to summary
private static boolean compat
messageback to summary
private String message
newSerialPersistentFieldsback to summary
private static final ObjectStreamField[] newSerialPersistentFields
newSerialVersionUIDback to summary
private static final long newSerialVersionUID
oldSerialPersistentFieldsback to summary
private static final ObjectStreamField[] oldSerialPersistentFields
oldSerialVersionUIDback to summary
private static final long oldSerialVersionUID
sequenceNumberback to summary
private long sequenceNumber
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
Serial Fields:
type:String
The notification type. A string expressed in a dot notation similar to Java properties. An example of a notification type is network.alarm.router
sequenceNumber:long
The notification sequence number. A serial number which identify particular instance of notification in the context of the notification source.
timeStamp:long
The notification timestamp. Indicating when the notification was generated
userData:Object
The notification user data. Used for whatever other data the notification source wishes to communicate to its consumers
message:String
The notification message.
source:Object
The object on which the notification initially occurred.
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.EventObject.serialVersionUID.

sourceback to summary
protected Object source

Hides java.util.EventObject.source.

This field hides the EventObject#source field in the parent class to make it non-transient and therefore part of the serialized form.

timeStampback to summary
private long timeStamp
typeback to summary
private String type
userDataback to summary
private Object userData

Constructor Detail

Notificationback to summary
public Notification(String type, Object source, long sequenceNumber)

Creates a Notification object. The notification timeStamp is set to the current date.

Parameters
type:String

The notification type.

source:Object

The notification source.

sequenceNumber:long

The notification sequence number within the source object.

Notificationback to summary
public Notification(String type, Object source, long sequenceNumber, String message)

Creates a Notification object. The notification timeStamp is set to the current date.

Parameters
type:String

The notification type.

source:Object

The notification source.

sequenceNumber:long

The notification sequence number within the source object.

message:String

The detailed message.

Notificationback to summary
public Notification(String type, Object source, long sequenceNumber, long timeStamp)

Creates a Notification object.

Parameters
type:String

The notification type.

source:Object

The notification source.

sequenceNumber:long

The notification sequence number within the source object.

timeStamp:long

The notification emission date.

Notificationback to summary
public Notification(String type, Object source, long sequenceNumber, long timeStamp, String message)

Creates a Notification object.

Parameters
type:String

The notification type.

source:Object

The notification source.

sequenceNumber:long

The notification sequence number within the source object.

timeStamp:long

The notification emission date.

message:String

The detailed message.

Method Detail

getMessageback to summary
public String getMessage()

Get the notification message.

Returns:String

The message string of this notification object.

getSequenceNumberback to summary
public long getSequenceNumber()

Get the notification sequence number.

Returns:long

The notification sequence number within the source object. It's a serial number identifying a particular instance of notification in the context of the notification source. The notification model does not assume that notifications will be received in the same order that they are sent. The sequence number helps listeners to sort received notifications.

See Also
setSequenceNumber
getTimeStampback to summary
public long getTimeStamp()

Get the notification timestamp.

Returns:long

The notification timestamp.

See Also
setTimeStamp
getTypeback to summary
public String getType()

Get the notification type.

Returns:String

The notification type. It's a string expressed in a dot notation similar to Java properties. It is recommended that the notification type should follow the reverse-domain-name convention used by Java package names. An example of a notification type is com.example.alarm.router.

getUserDataback to summary
public Object getUserData()

Get the user data.

Returns:Object

The user data object. It is used for whatever data the notification source wishes to communicate to its consumers.

See Also
setUserData
readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException

Deserializes a Notification from an ObjectInputStream.

setSequenceNumberback to summary
public void setSequenceNumber(long sequenceNumber)

Set the notification sequence number.

Parameters
sequenceNumber:long

The notification sequence number within the source object. It is a serial number identifying a particular instance of notification in the context of the notification source.

See Also
getSequenceNumber
setSourceback to summary
public void setSource(Object source)

Sets the source.

Parameters
source:Object

the new source for this object.

See Also
EventObject#getSource
setTimeStampback to summary
public void setTimeStamp(long timeStamp)

Set the notification timestamp.

Parameters
timeStamp:long

The notification timestamp. It indicates when the notification was generated.

See Also
getTimeStamp
setUserDataback to summary
public void setUserData(Object userData)

Set the user data.

Parameters
userData:Object

The user data object. It is used for whatever data the notification source wishes to communicate to its consumers.

See Also
getUserData
toStringback to summary
public String toString()

Overrides java.util.EventObject.toString.

Returns a String representation of this notification.

Returns:String

A String representation of this notification.

Annotations
@Override
writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException

Serializes a Notification to an ObjectOutputStream.