Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.sysactivity
Class SystemActivityEventDispatcher

java.lang.Object
  extended by net.java.sip.communicator.impl.sysactivity.SystemActivityEventDispatcher
All Implemented Interfaces:
Runnable

public class SystemActivityEventDispatcher
extends Object
implements Runnable

The class implements a dispatch event thread. The thread will fire event every time it is added through the fireSystemActivityEvent() method and would then deliver it to a registered listener if any. If the event has time set we used it as a delay before dispatching the event.

Author:
Damian Minkov

Constructor Summary
SystemActivityEventDispatcher()
           
 
Method Summary
 void addSystemActivityChangeListener(SystemActivityChangeListener listener)
          Registers a listener that would be notified of changes that have occurred in the underlying system.
protected  void fireSystemActivityEvent(SystemActivityEvent evt)
          Delivers the specified event to all registered listeners.
protected  void fireSystemActivityEvent(SystemActivityEvent evt, int wait)
          Delivers the specified event to all registered listeners.
 void removeSystemActivityChangeListener(SystemActivityChangeListener listener)
          Remove the specified listener so that it won't receive further notifications of changes that occur in the underlying system
 void run()
          Runs the waiting thread.
 void stop()
          Interrupts this dispatcher so that it would no longer disptach events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemActivityEventDispatcher

public SystemActivityEventDispatcher()
Method Detail

addSystemActivityChangeListener

public void addSystemActivityChangeListener(SystemActivityChangeListener listener)
Registers a listener that would be notified of changes that have occurred in the underlying system.

Parameters:
listener - the listener that we'd like to register for changes in the underlying system.

removeSystemActivityChangeListener

public void removeSystemActivityChangeListener(SystemActivityChangeListener listener)
Remove the specified listener so that it won't receive further notifications of changes that occur in the underlying system

Parameters:
listener - the listener to remove.

stop

public void stop()
Interrupts this dispatcher so that it would no longer disptach events.


fireSystemActivityEvent

protected void fireSystemActivityEvent(SystemActivityEvent evt)
Delivers the specified event to all registered listeners.

Parameters:
evt - the SystemActivityEvent that we'd like delivered to all registered message listeners.

fireSystemActivityEvent

protected void fireSystemActivityEvent(SystemActivityEvent evt,
                                       int wait)
Delivers the specified event to all registered listeners.

Parameters:
evt - the SystemActivityEvent that we'd like delivered to all registered message listeners.
wait - time in ms. to wait before firing the event.

run

public void run()
Runs the waiting thread.

Specified by:
run in interface Runnable

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.