org.norther.tammi.core.base
Class NotificationEmitterAdapter

java.lang.Object
  extended by org.norther.tammi.core.base.NotificationEmitterAdapter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter

public class NotificationEmitterAdapter
extends Object
implements NotificationEmitter, Serializable

An adapter class implementing the NotificationEmitter interface.

Note that the adapter must use hard references to its listeners as the original ones may have been wrapped by the MBean server with weak ones and they would be gced immediately if the emitter didn't maintain their hard references. So it's up to the listener to remove itself when it becomes stale.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
NotificationEmitterAdapter(NotificationEmitter adaptee)
          Constructs a new notification emitter.
 
Method Summary
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 void clearNotificationListeners()
          Clears all notification listeners.
 MBeanNotificationInfo[] getNotificationInfo()
           
 boolean hasListeners()
          Checks whether there are notification listeners.
 void removeNotificationListener(NotificationListener listener)
           
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 void sendNotification(Notification notif)
          Sends the specified notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationEmitterAdapter

public NotificationEmitterAdapter(NotificationEmitter adaptee)
Constructs a new notification emitter.

Parameters:
adaptee - the notification emitter adaptee.
Method Detail

addNotificationListener

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

removeNotificationListener

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

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

clearNotificationListeners

public void clearNotificationListeners()
Clears all notification listeners.


sendNotification

public void sendNotification(Notification notif)
Sends the specified notification.

Parameters:
notif - the notification to send.

hasListeners

public boolean hasListeners()
Checks whether there are notification listeners.

Returns:
true for listeners, false otherwise.


Copyright © 2004 The Norther Organization. All rights reserved.