org.ourgrid.common.fd
Class SimpleTestFailureDetector

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.ourgrid.common.rmi.OurgridUnicastRemoteObject
                  extended by org.ourgrid.common.fd.AbstractFailureDetector
                      extended by org.ourgrid.common.fd.SimpleTestFailureDetector
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, Shutdownable, Monitor, Monitorable

public class SimpleTestFailureDetector
extends AbstractFailureDetector

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ourgrid.common.fd.AbstractFailureDetector
BOUND_NAME, DEFAULT_PROTOCOL
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SimpleTestFailureDetector(int queryFrequency)
          Constructor
SimpleTestFailureDetector(MonitoringUnitFactory factory)
           
 
Method Summary
 GenericState getCurrentState()
          Retrieves the monitorable current status.
 void startMonitoring(int numberOfVerfications)
          This is a ThreadSafe implementation of startMonitoring method.
 
Methods inherited from class org.ourgrid.common.fd.AbstractFailureDetector
getEncarnationNumber, getFailureDetectorAddress, getMonitorables, pingNow, register, register, setMonitorableState, shutdown, startMonitoring, unregister, unregister
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTestFailureDetector

public SimpleTestFailureDetector(MonitoringUnitFactory factory)
                          throws java.rmi.RemoteException
Parameters:
factory - The MonitoringUnitFactory to be used.
Throws:
java.rmi.RemoteException - If anything wrong occurs.

SimpleTestFailureDetector

public SimpleTestFailureDetector(int queryFrequency)
                          throws java.rmi.RemoteException
Constructor

Parameters:
queryFrequency - The verification frequency.
Throws:
java.rmi.RemoteException - If anything wrong occurs.
Method Detail

getCurrentState

public GenericState getCurrentState()
                             throws java.rmi.RemoteException
Description copied from interface: Monitorable
Retrieves the monitorable current status.

Specified by:
getCurrentState in interface Monitorable
Specified by:
getCurrentState in class AbstractFailureDetector
Returns:
the Monitorable state.
Throws:
java.rmi.RemoteException - if anything wrong occurs in communication.

startMonitoring

public void startMonitoring(int numberOfVerfications)
                     throws java.rmi.RemoteException
This is a ThreadSafe implementation of startMonitoring method. This method makes numberOfVerfications verifications respecting the thread order. The second verification only will starts when the first terminates and so on. The method only finishes after all threads of all iterations have finished.

Notice that this method does not take the time in count. The QueryFrequency is ignored here.

Parameters:
numberOfVerfications - The number of verification iterations.
Throws:
java.rmi.RemoteException - If anything wrong occurs.
See Also:
ThreadServices, ThreadServices.waitUntilWorkIsDone()