Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.system
Class ListenerServiceMBeanSupport

    java.lang.Object
      org.jboss.mx.util.JBossNotificationBroadcasterSupport
          org.jboss.system.ServiceMBeanSupport
              org.jboss.system.ListenerServiceMBeanSupport

All Implemented Interfaces:
  EventListener, ListenerServiceMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, Service, ServiceMBean

public abstract class ListenerServiceMBeanSupport
extends ServiceMBeanSupport
implements ListenerServiceMBean, javax.management.NotificationListener

An abstract base class that provides for declarative JMX notification subscription handling.

A JBoss service that is in addition a NotificationListener can subclass ListenerServiceMBeanSupport instead of ServiceMBeanSupport and specify at run-time, inline in the MBean descriptor using the SubscriptionList attribute, the set of MBeans/notifications the service wants to subscribe/receive.

Call subscribe(boolean dynamicSubscriptions) at anytime to register to those MBeans and for those notifications that match the specified criteria. Call unsubscribe() to unsubscribe for Notifications.

If true is passed to subscribe() the baseclass will monitor for registration events from the MBeanServer and automatically subscribe to new instances of MBeans that match the subscription criteria. Monitoring for unsubscribe events in not necessary, since the MBeanServer automatically removes subscriptions to unregistering MBeans.

An alternative subscribe(boolean dynamicSubscription, ObjectName listener) can be used to specify a different MBean as the receiver of the subscribed notifications. The specified MBean must be a NotificationListener.

To handle the incoming notifications override the handleNotification2() method. The usual handleNotification() method should not be overriden, since it is used to monitor the incoming notifications for registration events coming from the MBeanServer, before delegating to handleNotification2(), in order to implement dynamic subscriptions.

Version:
  $Revision: 1.5.4.1 $
Author:
  Dimitris Andreadis
See Also:
  `REVISIONS ========= 19/10/04, dimitris renamed inner class MBeanInfo to SubscriptionInfo and made public, using NotificationFilter instead of NotificationFilterSupport and added new subscribe(List subscriptionList, boolean dynamicSubscriptions, ObjectName listener) to allow external programmatic specification of the subscription list. 28/02/04, dimitris explicit subscribe()/unsubscribe() replaced implicit start()/stop(); dynamic subscription behaviour can be enabled/disabled, plus it is now possible to specify an external MBean as notification listener.`

Nested Class Summary
`static class` | `ListenerServiceMBeanSupport.SubscriptionInfo` Inner data holder class to store the parsed subscription specification.

Field Summary

Fields inherited from class org.jboss.system.ServiceMBeanSupport
`log, server, SERVICE_CONTROLLER_SIG, serviceName`

Fields inherited from interface org.jboss.system.ListenerServiceMBean
`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
`ListenerServiceMBeanSupport()` Constructs a `ListenerServiceMBeanSupport`.
`ListenerServiceMBeanSupport(Class type)` Constructs a `ListenerServiceMBeanSupport`.
`ListenerServiceMBeanSupport(org.jboss.logging.Logger log)` Constructs a `ListenerServiceMBeanSupport`.
`ListenerServiceMBeanSupport(String category)` Constructs a `ListenerServiceMBeanSupport`.

Method Summary
`void` | `handleNotification(javax.management.Notification notification, Object handback)` DO NOT OVERRIDE THIS! Handles dynamic subscriptions before delegating to handleNotification2()
`void` | `handleNotification2(javax.management.Notification notification, Object handback)` Override to add notification handling!
`void` | `setSubscriptionList(Element list)` Used to configure the JMX notification subscriptions.
`void` | `subscribe(boolean dynamicSubscriptions)` Subscribes this MBean for JMX notifications.
`void` | `subscribe(boolean dynamicSubscriptions, javax.management.ObjectName listener)` Subscribes a listener MBean for JMX notifications.
`void` | `subscribe(List subscriptionList, boolean dynamicSubscriptions, javax.management.ObjectName listener)` Subscribes a listener MBean for JMX notifications.
`void` | `unsubscribe()` Unsubscribes for JMX notifications

Methods inherited from class org.jboss.system.ServiceMBeanSupport
`create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService`

Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
`addNotificationListener, getNotificationInfo, handleNotification, 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.ServiceMBean
`getName, getState, getStateString, jbossInternalLifecycle`

Methods inherited from interface org.jboss.system.Service
`create, destroy, start, stop`

Constructor Detail

### ListenerServiceMBeanSupport

    public ListenerServiceMBeanSupport()

  Constructs a `ListenerServiceMBeanSupport`.

### ListenerServiceMBeanSupport

    public ListenerServiceMBeanSupport(Class type)

  Constructs a `ListenerServiceMBeanSupport`. Pass-through to ServiceMBeanSupport.

Parameters:
  `type` - The class type to determine Logger name from.

### ListenerServiceMBeanSupport

    public ListenerServiceMBeanSupport(String category)

  Constructs a `ListenerServiceMBeanSupport`. Pass-through to ServiceMBeanSupport.

Parameters:
  `category` - The logger category name.

### ListenerServiceMBeanSupport

    public ListenerServiceMBeanSupport(org.jboss.logging.Logger log)

  Constructs a `ListenerServiceMBeanSupport`. Pass-through to ServiceMBeanSupport.

Parameters:
  `log` - The logger to use.

Method Detail

### setSubscriptionList

    public void setSubscriptionList(Element list)

  Used to configure the JMX notification subscriptions. The configuration is done inline in the mbean descriptor. See jboss-subscription.dtd

  Specified by:
    `setSubscriptionList` in interface `ListenerServiceMBean`

### subscribe

    public void subscribe(boolean dynamicSubscriptions)
                   throws Exception

  Subscribes this MBean for JMX notifications.

  Parameters:
    `dynamicSubscriptions` - indicates whether to monitor and subscribe to new MBeans that match the specification.
  Throws:
    `Exception`

### subscribe

    public void subscribe(boolean dynamicSubscriptions,
                          javax.management.ObjectName listener)
                   throws Exception

  Subscribes a listener MBean for JMX notifications.

  Parameters:
    `dynamicSubscriptions` - indicates whether to monitor and subscribe to new MBeans that match the specification.
    `listener` - the receiver of the notifications.
  Throws:
    `Exception`

### subscribe

    public void subscribe(List subscriptionList,
                          boolean dynamicSubscriptions,
                          javax.management.ObjectName listener)
                   throws Exception

  Subscribes a listener MBean for JMX notifications.

  Parameters:
    `subscriptionList` - the list containing SubscriptionInfo data.
    `dynamicSubscriptions` - indicates whether to monitor and subscribe to new MBeans that match the specification.
    `listener` - the receiver of the notifications.
  Throws:
    `Exception`

### unsubscribe

    public void unsubscribe()

  Unsubscribes for JMX notifications

### handleNotification

    public void handleNotification(javax.management.Notification notification,
                                   Object handback)

  DO NOT OVERRIDE THIS! Handles dynamic subscriptions before delegating to handleNotification2()

  Specified by:
    `handleNotification` in interface `javax.management.NotificationListener`

### handleNotification2

    public void handleNotification2(javax.management.Notification notification,
                                    Object handback)

  Override to add notification handling!

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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