org.jboss.monitor.services
Class NotificationListener

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.system.ListenerServiceMBeanSupport
              extended by org.jboss.monitor.services.NotificationListener
All Implemented Interfaces:
EventListener, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, NotificationListenerMBean, org.jboss.system.ListenerServiceMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class NotificationListener
extends org.jboss.system.ListenerServiceMBeanSupport
implements NotificationListenerMBean

A simple JMX notification listener that outputs notifications as log.INFO messages, and demonstrates the usefulness of ListenerServiceMBeanSupport.

Version:
$Revision: 1.3.4.3 $
Author:
Dimitris Andreadis

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.system.ListenerServiceMBeanSupport
org.jboss.system.ListenerServiceMBeanSupport.SubscriptionInfo
 
Field Summary
protected  org.jboss.logging.DynamicLogger log
          The dynamic logger
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ListenerServiceMBean
SL_FILTER_ELEMENT, SL_FILTER_FACTORY_ATTRIBUTE, SL_MBEAN_ELEMENT, SL_MBEAN_HANDBACK_ATTRIBUTE, SL_MBEAN_NAME_ATTRIBUTE, SL_NOTIFICATION_ELEMENT, SL_NOTIFICATION_TYPE_ATTRIBUTE, SL_ROOT_ELEMENT
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
NotificationListener()
          CTOR
 
Method Summary
 boolean getDynamicSubscriptions()
          Gets the dynamic subscriptions status
 String getLogLevel()
          Gets the dynamic log level
 long getNotificationCount()
          Number of notifications received.
 javax.management.ObjectName getNotificationListener()
          Gets listener of notifications
 void handleNotification2(javax.management.Notification notification, Object handback)
          Overriden to add handling!
 void setDynamicSubscriptions(boolean dynamicSubscriptions)
          Enables/disables dynamic subscriptions
 void setLogLevel(String logLevel)
          Sets the dynamic log level
 void setNotificationListener(javax.management.ObjectName notificationListener)
          Sets listener of notifications
 void startService()
          Start
 void stopService()
          Stop
 
Methods inherited from class org.jboss.system.ListenerServiceMBeanSupport
handleNotification, setSubscriptionList, subscribe, subscribe, subscribe, unsubscribe
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ListenerServiceMBean
setSubscriptionList
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

log

protected org.jboss.logging.DynamicLogger log
The dynamic logger

Constructor Detail

NotificationListener

public NotificationListener()
CTOR

Method Detail

getNotificationCount

public long getNotificationCount()
Number of notifications received.

Specified by:
getNotificationCount in interface NotificationListenerMBean

setDynamicSubscriptions

public void setDynamicSubscriptions(boolean dynamicSubscriptions)
Enables/disables dynamic subscriptions

Specified by:
setDynamicSubscriptions in interface NotificationListenerMBean

getDynamicSubscriptions

public boolean getDynamicSubscriptions()
Gets the dynamic subscriptions status

Specified by:
getDynamicSubscriptions in interface NotificationListenerMBean

setNotificationListener

public void setNotificationListener(javax.management.ObjectName notificationListener)
Sets listener of notifications

Specified by:
setNotificationListener in interface NotificationListenerMBean

getNotificationListener

public javax.management.ObjectName getNotificationListener()
Gets listener of notifications

Specified by:
getNotificationListener in interface NotificationListenerMBean

setLogLevel

public void setLogLevel(String logLevel)
Sets the dynamic log level

Specified by:
setLogLevel in interface NotificationListenerMBean

getLogLevel

public String getLogLevel()
Gets the dynamic log level

Specified by:
getLogLevel in interface NotificationListenerMBean

startService

public void startService()
                  throws Exception
Start

Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

stopService

public void stopService()
                 throws Exception
Stop

Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

handleNotification2

public void handleNotification2(javax.management.Notification notification,
                                Object handback)
Overriden to add handling!

Overrides:
handleNotification2 in class org.jboss.system.ListenerServiceMBeanSupport


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.