HOME

com.ireasoning.protocol
Class ListenerManager

java.lang.Object
  extended bycom.ireasoning.protocol.ListenerManager
Direct Known Subclasses:
Session, SnmpPoller

public class ListenerManager
extends Object

This class provides functionalities to manage Listener pool, including methods such as add/remove/notify listeners.


Field Summary
protected  Listener[] _listeners
          Array of registered Listener objects.
 
Constructor Summary
ListenerManager()
           
 
Method Summary
 void addListener(Listener listener)
          This method allows the registration of event listeners.
protected  boolean listenerExists()
          Checks if there's any listener registered
 void notifyListeners(Msg msg)
          Notifys all listeners on just recieved message
 void notifyListeners(Msg[] msg)
          Notifys all listeners on just recieved message
 void removeListener(Listener listener)
          This method allows the removal of event listeners from the event target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_listeners

protected Listener[] _listeners
Array of registered Listener objects.

Constructor Detail

ListenerManager

public ListenerManager()
Method Detail

addListener

public void addListener(Listener listener)
This method allows the registration of event listeners. Listener.handleMsg(Session session, Msg msg) will get called if Session recieves message.

Parameters:
listener - an object which implements Listener interface. If passed listener already exists, it will not be added.
See Also:
Listener.handleMsg(java.lang.Object, com.ireasoning.protocol.Msg)

removeListener

public void removeListener(Listener listener)
This method allows the removal of event listeners from the event target. If an EventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions.

Parameters:
listener - an object which implements Listener interface

listenerExists

protected boolean listenerExists()
Checks if there's any listener registered

Returns:
true if there's at least one listener registered

notifyListeners

public void notifyListeners(Msg msg)
Notifys all listeners on just recieved message

Parameters:
msg - the message object to notify

notifyListeners

public void notifyListeners(Msg[] msg)
Notifys all listeners on just recieved message

Parameters:
msg - the message object to notify

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.