org.jmonit.events
Class DefaultMonitoringEventBus

java.lang.Object
  extended by org.jmonit.events.DefaultMonitoringEventBus
All Implemented Interfaces:
MonitoringEventBus

public class DefaultMonitoringEventBus
extends java.lang.Object
implements MonitoringEventBus

A synchronous implementation of the MonitoringEventBus.

"Synchronous" means the event is dispatched to and consumed by all listeners before the emitter can resume processing.

Author:
Nicolas De Loof

Constructor Summary
DefaultMonitoringEventBus()
           
 
Method Summary
 void addListener(MonitoringEventListener listener)
          Adds the listener to the collection of listeners who will be notifed when any monitoring event occurs.
 void fireMonitoringEvent(MonitoringEvent event)
          Dispatches the given MonitoringEvent to all registred listeners (calls method MonitoringEventListener.onMonitoringEvent(MonitoringEvent) on all of them}.
 boolean hasListener(MonitoringEventListener listener)
          Returns whether the specified instance of monitoring listener was added to the collection of listeners who will be notifed when an transfer event occurs
 void removeListener(MonitoringEventListener listener)
          Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMonitoringEventBus

public DefaultMonitoringEventBus()
Method Detail

addListener

public void addListener(MonitoringEventListener listener)
Adds the listener to the collection of listeners who will be notifed when any monitoring event occurs.
If listener is null, no exception is thrown and no action is performed

Specified by:
addListener in interface MonitoringEventBus
Parameters:
listener - the monitoring listener
See Also:
MonitoringEventBus.addListener(org.jmonit.events.MonitoringEventListener)

removeListener

public void removeListener(MonitoringEventListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
If listener is null or specified listener was not added to this MonitoringEventSupport object no exception is thrown and no action is performed

Specified by:
removeListener in interface MonitoringEventBus
Parameters:
listener - the monitoring listener
See Also:
MonitoringEventBus.removeListener(MonitoringEventListener)

hasListener

public boolean hasListener(MonitoringEventListener listener)
Returns whether the specified instance of monitoring listener was added to the collection of listeners who will be notifed when an transfer event occurs

Specified by:
hasListener in interface MonitoringEventBus
Parameters:
listener - the transfer listener
Returns:
true if given listener was added to the collection of listeners false otherwise
See Also:
MonitoringEventBus.hasListener(MonitoringEventListener)

fireMonitoringEvent

public void fireMonitoringEvent(MonitoringEvent event)
Dispatches the given MonitoringEvent to all registred listeners (calls method MonitoringEventListener.onMonitoringEvent(MonitoringEvent) on all of them}.

Specified by:
fireMonitoringEvent in interface MonitoringEventBus
Parameters:
event - the MonitorTaggedEvent which will be dispached to listeners
See Also:
MonitoringEventBus.fireMonitoringEvent(org.jmonit.events.MonitoringEvent)


Copyright © 2007 Nicolas De Loof. All Rights Reserved.