public final class UsageNotification extends Notification implements VendorExtensions
UsageMBean
to indicate a counter-type
usage parameter has been updated or a sample-type usage parameter has accumulated a
new sample. Usage notifications are only generated for usage parameters for which the
generation of usage notifications has been enabled. Control of notification generation
is managed via a UsageNotificationManagerMBean
object.
Usage notifications contain a NotificationSource
object that can be used to
obtain more information about the object that caused the usage notification to be
generated. The type of a usage notification can be used to infer the type of the
notification source object in the notification:
Notification.getType()
== SbbNotification.USAGE_NOTIFICATION_TYPE
then the type of the notification source object is SbbNotification
.
Notification.getType()
== ResourceAdaptorEntityNotification.USAGE_NOTIFICATION_TYPE
then the type of the notification source object is ResourceAdaptorEntityNotification
.
Notification.getType()
== SubsystemNotification.USAGE_NOTIFICATION_TYPE
then the type of the notification source object is SubsystemNotification
.
source
Constructor and Description |
---|
UsageNotification(SbbUsageMBean sbbUsageMBean,
ServiceID serviceID,
SbbID sbbID,
String paramSet,
String paramName,
boolean counter,
long value,
long sequenceNumber,
long timestamp)
Deprecated.
Usage notifications have been expanded with new attributes to take advantage
of the new features provided by the SLEE specification. The
UsageNotification(String, UsageMBean, NotificationSource, String, String, boolean, long, long, long)
constructor should be used instead of this constructor. |
UsageNotification(String type,
UsageMBean usageMBean,
NotificationSource notificationSource,
String paramSet,
String paramName,
boolean counter,
long value,
long sequenceNumber,
long timestamp)
Create a
UsageNotification to notify listeners of an update to a usage
parameter's value. |
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.
|
NotificationSource |
getNotificationSource()
Get the object that identifies the component or subsystem in the SLEE that caused this
usage notification to be generated.
|
SbbID |
getSbb()
Deprecated.
Replaced with
getNotificationSource() in order to specify a
broader range of usage sources. |
ServiceID |
getService()
Deprecated.
Replaced with
getNotificationSource() in order to specify a
broader range of usage sources. |
String |
getUsageParameterName()
Get the name of the usage parameter that was updated.
|
String |
getUsageParameterSetName()
Get the name of the usage parameter set containing the usage parameter thas was updated.
|
long |
getValue()
Get the updated value or emitted sample of the usage parameter.
|
Object |
getVendorData()
Get the vendor-specific data.
|
int |
hashCode()
Get a hash code value for this notification.
|
boolean |
isCounter()
Determine if the usage parameter updated is counter-type or sample-type.
|
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 UsageNotification(SbbUsageMBean sbbUsageMBean, ServiceID serviceID, SbbID sbbID, String paramSet, String paramName, boolean counter, long value, long sequenceNumber, long timestamp) throws NullPointerException
UsageNotification(String, UsageMBean, NotificationSource, String, String, boolean, long, long, long)
constructor should be used instead of this constructor.UsageNotification
containing the updated value of an SBB's usage
parameter. The notification's notificationSource
attribute is set to an
SbbNotification
encapsulating the serviceID
and sbbID
arguments.sbbUsageMBean
- the SbbUsageMBean
object that is
emitting this notification.serviceID
- the component identifier of the Service whose SBB's usage
parameter was updated.sbbID
- the component identifier of the SBB whose usage parameter was updated.paramSet
- the name of the SBB usage parameter set containing the usage parameter
that was updated. If the unamed usage parameter set was updated, this value
is null
.paramName
- the name of the usage parameter that was updated.value
- this is either the new value of the usage parameter (for counter-type
usage parameters), or a sample value (for sample-type usage parameters).sequenceNumber
- the notification sequence number within the source
SbbUsageMBean
.timestamp
- the time (in ms since January 1, 1970 UTC) that the notification
was generated.NullPointerException
- if notificationSource
, serviceID
,
sbbID
or paramName
is null
.public UsageNotification(String type, UsageMBean usageMBean, NotificationSource notificationSource, String paramSet, String paramName, boolean counter, long value, long sequenceNumber, long timestamp) throws NullPointerException
UsageNotification
to notify listeners of an update to a usage
parameter's value.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.usageMBean
- the UsageMBean
object that is emitting this
notification.notificationSource
- the component or subsystem in the SLEE that caused this
notification to be generated.paramSet
- the name of the usage parameter set containing the usage parameter that
was updated. If the unamed usage parameter set was updated, this value is
null
.paramName
- the name of the usage parameter that was updated.value
- this is either the new value of the usage parameter (for counter-type
usage parameters), or a sample value (for sample-type usage parameters).sequenceNumber
- the notification sequence number within the source UsageMBean
.timestamp
- the time (in ms since January 1, 1970 UTC) that the notification
was generated.NullPointerException
- if type
, usageMBean
,
notificationSource
, or paramName
is null
.public NotificationSource getNotificationSource()
SbbNotification
.public ServiceID getService()
getNotificationSource()
in order to specify a
broader range of usage sources.null
for SLEE 1.1-compliant notifications unless the
notification source is of type SbbNotification
, in which case the value
of SbbNotification.getService()
is returned.public SbbID getSbb()
getNotificationSource()
in order to specify a
broader range of usage sources.null
for SLEE 1.1-compliant notifications unless the
notification source is of type SbbNotification
, in which case the value
of SbbNotification.getSbb()
is returned.public String getUsageParameterSetName()
null
if the usage parameter
was a member of the unnamed usage parameter set.public String getUsageParameterName()
public boolean isCounter()
true
if the usage parameter updated is counter-type,
false
if the usage parameter updated is sample-type.public long getValue()
isCounter()
returns true
this value is the updated value of the counter-type usage
parameter. If isCounter()
returns false
this value is a sample
value for the usage parameter.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 service component identifier reference, a SLEE 1.0-based comparison is performed. Otherwise, a SLEE 1.1-based comparison is performed.
The SLEE 1.0-based comparison considers two notifications to be equal if obj
is an instance of this class and the service and SBB component identifiers, parameter set
name, parameter name, and parameter type (counter or sample) 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 notification source, parameter set name, parameter
name, and parameter type (counter or sample) are the same as the corresponding attributes
of this
.
Note that a SLEE 1.0-compliant usage notification can never be equal to a SLEE 1.1-compliant usage notification.
public int hashCode()
public String toString()
toString
in class Notification