cz.cuni.amis.pogamut.base.utils.jmx.flag
Class JMXFlagDecorator<T extends Serializable>

Package class diagram package JMXFlagDecorator
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.jmx.flag.JMXFlagDecorator<T>
All Implemented Interfaces:
JMXFlagDecoratorMBean, NotificationBroadcaster, NotificationEmitter

public class JMXFlagDecorator<T extends Serializable>
extends Object
implements JMXFlagDecoratorMBean, NotificationEmitter

Translates Flag events to JMX events. Adds a listener on the flag and resends the events to supplied broadcaster support.

Author:
Ik

Field Summary
protected  int eventCounter
           
protected  cz.cuni.amis.utils.flag.Flag<T> flag
           
protected  String flagName
           
protected  cz.cuni.amis.utils.flag.FlagListener<T> listener
           
protected  NotificationBroadcasterSupport nbs
          Support object for sending notifications.
protected  ObjectName source
           
 
Constructor Summary
JMXFlagDecorator(cz.cuni.amis.utils.flag.Flag<T> flag, ObjectName source, MBeanServer mbs, String flagName)
           
 
Method Summary
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 Serializable getFlag()
           
 MBeanNotificationInfo getMBeanNotificationInfo()
           
 MBeanNotificationInfo[] getNotificationInfo()
           
 void removeNotificationListener(NotificationListener listener)
           
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 void stop()
          Stops listening for the flag events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flag

protected cz.cuni.amis.utils.flag.Flag<T extends Serializable> flag

source

protected ObjectName source

eventCounter

protected int eventCounter

flagName

protected String flagName

listener

protected cz.cuni.amis.utils.flag.FlagListener<T extends Serializable> listener

nbs

protected NotificationBroadcasterSupport nbs
Support object for sending notifications.

Constructor Detail

JMXFlagDecorator

public JMXFlagDecorator(cz.cuni.amis.utils.flag.Flag<T> flag,
                        ObjectName source,
                        MBeanServer mbs,
                        String flagName)
                 throws MalformedObjectNameException,
                        InstanceAlreadyExistsException,
                        MBeanRegistrationException,
                        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:
MalformedObjectNameException
InstanceAlreadyExistsException
MBeanRegistrationException
NotCompliantMBeanException
Method Detail

stop

public void stop()
Stops listening for the flag events.


getMBeanNotificationInfo

public MBeanNotificationInfo getMBeanNotificationInfo()
Returns:
Notification info about this events possibly raised by this flag.

getFlag

public Serializable getFlag()
Specified by:
getFlag in interface JMXFlagDecoratorMBean
Returns:
Current flag value.

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationEmitter
Throws:
ListenerNotFoundException

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
                             throws IllegalArgumentException
Specified by:
addNotificationListener in interface NotificationBroadcaster
Throws:
IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationBroadcaster
Throws:
ListenerNotFoundException

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface NotificationBroadcaster


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.