Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.netaddr
Class NetworkEventDispatcher

java.lang.Object
  extended by net.java.sip.communicator.impl.netaddr.NetworkEventDispatcher
All Implemented Interfaces:
Runnable

public class NetworkEventDispatcher
extends Object
implements Runnable

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

Author:
Damian Minkov

Constructor Summary
NetworkEventDispatcher()
           
 
Method Summary
(package private)  void addNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener)
          Adds new NetworkConfigurationChangeListener which will be informed for network configuration changes.
protected  void fireChangeEvent(ChangeEvent evt)
          Fire ChangeEvent.
protected  void fireChangeEvent(ChangeEvent evt, int wait)
          Fire ChangeEvent.
(package private) static void fireChangeEvent(ChangeEvent evt, NetworkConfigurationChangeListener listener)
          Fire ChangeEvent.
 boolean isRunning()
          Returns true if this dispatcher is currently running and delivering events when available and false otherwise.
(package private)  void removeNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener)
          Remove NetworkConfigurationChangeListener.
 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

NetworkEventDispatcher

public NetworkEventDispatcher()
Method Detail

addNetworkConfigurationChangeListener

void addNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener)
Adds new NetworkConfigurationChangeListener which will be informed for network configuration changes.

Parameters:
listener - the listener.

removeNetworkConfigurationChangeListener

void removeNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener)
Remove NetworkConfigurationChangeListener.

Parameters:
listener - the listener.

fireChangeEvent

protected void fireChangeEvent(ChangeEvent evt)
Fire ChangeEvent.

Parameters:
evt - the event to fire.

fireChangeEvent

protected void fireChangeEvent(ChangeEvent evt,
                               int wait)
Fire ChangeEvent.

Parameters:
evt - the event to fire.

fireChangeEvent

static void fireChangeEvent(ChangeEvent evt,
                            NetworkConfigurationChangeListener listener)
Fire ChangeEvent.

Parameters:
evt - the event to fire.

run

public void run()
Runs the waiting thread.

Specified by:
run in interface Runnable

stop

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


isRunning

public boolean isRunning()
Returns true if this dispatcher is currently running and delivering events when available and false otherwise.

Returns:
true if this dispatcher is currently running and delivering events when available and false otherwise.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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