org.objectweb.tribe.faultdetection
Class PingManagerThread

java.lang.Object
  extended byorg.objectweb.tribe.faultdetection.PingManagerThread
All Implemented Interfaces:
java.lang.Runnable

public class PingManagerThread
extends java.lang.Object
implements java.lang.Runnable

This class defines a PingManagerThread. A ping thread will periodically send ping to addresses and send events to registered listeners.

Version:
1.0
Author:
Nicolas Modrzyk

Constructor Summary
PingManagerThread(IpAddress localAddress, long waitInterval)
          Creates a new PingManagerThread object
 
Method Summary
 void addListener(FaultDetectionListener listener)
          Register a new ping listener, that will receive ping events
 void addPingHook(Address address)
          Tell the thread it shoudl start pinging a new address
 void getResult(IpAddress address)
          Get the result and call back events on listeners
 long getWaitInterval()
          Returns the waitInterval value.
 void notifyListenerOfEvent(int event, IpAddress address)
          Notify listeners of an event on the specified address
 void removeListener(FaultDetectionListener listener)
          Unregister a ping listener
 void removePingHook(Address address)
          Tell the thread to stop pinging an address
 void run()
           
 void setStop(boolean stop)
          Tell the thread to stop as soon as possible
 void setWaitInterval(long waitInterval)
          Sets the waitInterval value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingManagerThread

public PingManagerThread(IpAddress localAddress,
                         long waitInterval)
Creates a new PingManagerThread object

Parameters:
localAddress -
waitInterval - the time between two ping
Method Detail

setStop

public void setStop(boolean stop)
Tell the thread to stop as soon as possible

Parameters:
stop - The stop to set.

getWaitInterval

public long getWaitInterval()
Returns the waitInterval value.

Returns:
Returns the waitInterval.

setWaitInterval

public void setWaitInterval(long waitInterval)
Sets the waitInterval value.

Parameters:
waitInterval - The waitInterval to set.

addPingHook

public void addPingHook(Address address)
Tell the thread it shoudl start pinging a new address

Parameters:
address - Address to ping

removePingHook

public void removePingHook(Address address)
Tell the thread to stop pinging an address

Parameters:
address - Address to stop pinging

addListener

public void addListener(FaultDetectionListener listener)
Register a new ping listener, that will receive ping events

Parameters:
listener - FaultDetectionListener object that will then receive events and results of ping action

removeListener

public void removeListener(FaultDetectionListener listener)
Unregister a ping listener

Parameters:
listener - FaultDetectionListener will not receive further events

getResult

public void getResult(IpAddress address)
Get the result and call back events on listeners

Parameters:
address - IpAddress of the result to get

notifyListenerOfEvent

public void notifyListenerOfEvent(int event,
                                  IpAddress address)
Notify listeners of an event on the specified address

Parameters:
event - an int representing the event value
address - the address where the event occured
See Also:
FaultDetectionService

run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.