public class UsageThresholdFilter extends Object implements NotificationFilter
UsageNotification
s where the
notification source usage parameter name match specified values, and the value of the
usage parameter has crossed a specified threshold (in either the positive or negative
direction).
Each time a usage notification is seen for the specified usage parameter, the current value of the usage parameter is stored. If the previous value and the current value lie on opposite sides of the threshold, the notification is passed to notification listeners. If the previous value was equal to the threshold value, the notification is only passed to notification listeners if the direction on the real axis from the previous value to the current value is the same as the approach made to the threshold value.
For example, if the threshold value is set to 10, and three usage notifications with the values 9, 10, and 9 respectively are generated by the SLEE, this notification filter would not pass any of the usage notifications to notification listeners as the threshold has not been crossed. However if three usage notifications with the values 9, 10, and 11 respectively are generated by the SLEE, this notification filter would pass only the last usage notification to notification listeners, as this represents the point when the threshold has been crossed.
In any other situation where the threshold value is not crossed, the notification is suppressed.
If the notification contains usage information for some other notification source or usage parameter, it is also suppressed.
Notifications that are not instances of UsageNotification
are also suppressed
by this filter.
Constructor and Description |
---|
UsageThresholdFilter(NotificationSource notificationSource,
String paramName,
long threshold)
Create a
UsageThresholdFilter . |
UsageThresholdFilter(ServiceID service,
SbbID sbb,
String paramName,
long threshold)
Deprecated.
Replaced with
UsageThresholdFilter(NotificationSource, String, long)
as usage collecting has been expanded to include SLEE components other than SBBs. |
Modifier and Type | Method and Description |
---|---|
boolean |
isNotificationEnabled(Notification notification)
Determine whether the specified notification should be delivered to notification
listeners using this notification filter.
|
public UsageThresholdFilter(ServiceID service, SbbID sbb, String paramName, long threshold) throws NullPointerException
UsageThresholdFilter(NotificationSource, String, long)
as usage collecting has been expanded to include SLEE components other than SBBs.UsageThresholdFilter
. A filter created using this constructor will
only allow SLEE 1.0-compliant usage notifications to pass through where they otherwise
satisfy the filtering criteria.service
- the component identifier of the Service whose usage parameter
should be monitored.sbb
- the component identifier of the SBB whose usage parameter should be
monitored.paramName
- the name of a usage parameter defined by the SBB.threshold
- the threshold value.NullPointerException
- if service
, sbb
, or
paramName
is null
.public UsageThresholdFilter(NotificationSource notificationSource, String paramName, long threshold) throws NullPointerException
UsageThresholdFilter
. A filter created using this constructor will
only allow SLEE 1.1-compliant usage notifications to pass through where they otherwise
satisfy the filtering criteria.notificationSource
- the notification source whose usage parameter should be
monitored.paramName
- the name of a usage parameter defined by the SBB.threshold
- the threshold value.NullPointerException
- if notificationSource
or paramName
is null
.public boolean isNotificationEnabled(Notification notification)
isNotificationEnabled
in interface NotificationFilter
notification
- the notification to be sent.true
if the notification should be delivered to notification
listeners, false
otherwise. This method always returns
false
if notification
is not an instance of
UsageNotification
.