cz.cuni.amis.pogamut.base.utils.jmx.flag
Class JMXFlagDecorator<T extends java.io.Serializable>
java.lang.Object
cz.cuni.amis.pogamut.base.utils.jmx.flag.JMXFlagDecorator<T>
- All Implemented Interfaces:
- JMXFlagDecoratorMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter
public class JMXFlagDecorator<T extends java.io.Serializable>
- extends java.lang.Object
- implements JMXFlagDecoratorMBean, javax.management.NotificationEmitter
Translates Flag events to JMX events. Adds a listener on the flag and resends
the events to supplied broadcaster support.
Constructor Summary |
JMXFlagDecorator(Flag<T> flag,
javax.management.ObjectName source,
javax.management.MBeanServer mbs,
java.lang.String flagName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
flag
protected Flag<T extends java.io.Serializable> flag
source
protected javax.management.ObjectName source
eventCounter
protected int eventCounter
flagName
protected java.lang.String flagName
listener
protected FlagListener<T extends java.io.Serializable> listener
nbs
protected javax.management.NotificationBroadcasterSupport nbs
- Support object for sending notifications.
JMXFlagDecorator
public JMXFlagDecorator(Flag<T> flag,
javax.management.ObjectName source,
javax.management.MBeanServer mbs,
java.lang.String flagName)
throws javax.management.MalformedObjectNameException,
javax.management.InstanceAlreadyExistsException,
javax.management.MBeanRegistrationException,
javax.management.NotCompliantMBeanException
- Parameters:
flag
- Flag to be exposed through JMX.source
- MBean or ObjectName of the object where the flag resides.nbs
- NotificationBroadcasterSupport through which the events will be send.
- Throws:
javax.management.MalformedObjectNameException
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.NotCompliantMBeanException
stop
public void stop()
- Stops listening for the flag events.
getMBeanNotificationInfo
public javax.management.MBeanNotificationInfo getMBeanNotificationInfo()
- Returns:
- Notification info about this events possibly raised by this flag.
getFlag
public java.io.Serializable getFlag()
- Specified by:
getFlag
in interface JMXFlagDecoratorMBean
- Returns:
- Current flag value.
removeNotificationListener
public void removeNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
throws javax.management.ListenerNotFoundException
- Specified by:
removeNotificationListener
in interface javax.management.NotificationEmitter
- Throws:
javax.management.ListenerNotFoundException
addNotificationListener
public void addNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
throws java.lang.IllegalArgumentException
- Specified by:
addNotificationListener
in interface javax.management.NotificationBroadcaster
- Throws:
java.lang.IllegalArgumentException
removeNotificationListener
public void removeNotificationListener(javax.management.NotificationListener listener)
throws javax.management.ListenerNotFoundException
- Specified by:
removeNotificationListener
in interface javax.management.NotificationBroadcaster
- Throws:
javax.management.ListenerNotFoundException
getNotificationInfo
public javax.management.MBeanNotificationInfo[] getNotificationInfo()
- Specified by:
getNotificationInfo
in interface javax.management.NotificationBroadcaster