org.ourgrid.common.fd
Class MachinesPinger

java.lang.Object
  extended by java.util.TimerTask
      extended by org.ourgrid.common.fd.MachinesPinger
All Implemented Interfaces:
java.lang.Runnable

public class MachinesPinger
extends java.util.TimerTask

Objects of this class are used to execute real pings on Grid Machines through a MachinesPingerThread. It is created a new thread to ping each machine avoiding the necessity to wait for a ping to return. When the ping returns, the Grid Machine state is updated in the Monitor passed in the constructor.


Constructor Summary
MachinesPinger(Monitor fd, java.util.concurrent.ExecutorService threadpool)
          The constructor.
 
Method Summary
 boolean cancel()
           
 void run()
          This method retrieves the Grid Machines to be pinged from the FailureDetector and fires a MachinesPingerThread for each machine.
 
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MachinesPinger

public MachinesPinger(Monitor fd,
                      java.util.concurrent.ExecutorService threadpool)
The constructor.

Parameters:
fd - Object responsible for maintaining the updated states of Grid Machines and providing machines to be pinged.
threadpool - Pool to execute pingers in.
Method Detail

run

public void run()
This method retrieves the Grid Machines to be pinged from the FailureDetector and fires a MachinesPingerThread for each machine. This thread makes real pings on them and updates their state on the FailureDetector.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask

cancel

public boolean cancel()
Overrides:
cancel in class java.util.TimerTask