org.objectweb.proactive.core.body.ft.servers
Class FTServer

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended byorg.objectweb.proactive.core.body.ft.servers.FTServer
All Implemented Interfaces:
CheckpointServer, FaultDetector, LocationServer, RecoveryProcess, java.rmi.Remote, ResourceServer, java.io.Serializable

public class FTServer
extends java.rmi.server.UnicastRemoteObject
implements FaultDetector, LocationServer, RecoveryProcess, ResourceServer, CheckpointServer

This server contains one instance of each needed servers for fault tolerance, and delegates each method call to the concerned subserver.

Since:
3.0
Author:
cdelbe
See Also:
Serialized Form

Field Summary
static int DEFAULT_FDETECT_SCAN_PERIOD
          Period of the failure detector sanning (ms)
static int DEFAULT_PORT
          Default server port
static java.lang.String DEFAULT_SERVER_NAME
          Default name of this server
protected static org.apache.log4j.Logger logger
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.objectweb.proactive.core.body.ft.servers.faultdetection.FaultDetector
IS_DEAD, OK
 
Fields inherited from interface org.objectweb.proactive.core.body.ft.servers.recovery.RecoveryProcess
FAILED, RECOVERING, RUNNING
 
Constructor Summary
FTServer()
           
 
Method Summary
 void addFreeNode(Node n)
          Add a new node usable for recovery.
 void addInfoToCheckpoint(CheckpointInfo ci, UniqueID id, int sequenceNumber, int incarnation)
          Add informations to an already stored checkpoint
 void commitHistory(HistoryUpdater rh)
          Add an history to a checkpoint.
 void failureDetected(UniqueID id)
          Notify the recovery process that the body passed in paramater is suspected to be failed.
 void forceDetection()
          Force a failure detection even if the failure detector thread is waiting.
 java.util.ArrayList getAllLocations()
          Return the list of locations of all registered bodies.
 Checkpoint getCheckpoint(UniqueID id, int sequenceNumber)
          Return a checkpoint of the object identified by id.
 CheckpointServer getCheckpointServer()
           
 FaultDetector getFaultDetector()
           
 Node getFreeNode()
          Return the next available node for recovery
 CheckpointInfo getInfoFromCheckpoint(UniqueID id, int sequenceNumber)
          Return informations on the given checkpoint
 Checkpoint getLastCheckpoint(UniqueID id)
          Return the latest checkpoint of the object identified by id
 UniversalBody getLocation(UniqueID id)
          Return the current known location of a registred body.
 LocationServer getLocationServer()
           
 RecoveryProcess getRecoveryProcess()
           
 ResourceServer getResourceServer()
           
 java.lang.String getServerCodebase()
          Return the URL of the classServer linked to this checkpointServer.
 int getSystemSize()
          Return the size of the system, i.e. the number of registred bodies.
 void init(FaultDetector fd, LocationServer ls, RecoveryProcess rp, ResourceServer rs, CheckpointServer cs)
          Initialized server with each needed subservers
 void initialize()
          Reinit the state of the fault detector
 boolean isUnreachable(UniversalBody body)
          The fault detector test the reachability of the active object body by sending a heartbeat message to body.
 void outputCommit(MessageInfo mi)
          The state of the system must be commited before the sent of the message linked to the messageInfo mi.
 void register(UniqueID id)
          Register the calling AO.
 UniversalBody searchObject(UniqueID id, UniversalBody oldLocation, UniqueID caller)
          Return the current location of object id.
 void setCheckpointServer(CheckpointServer checkpointServer)
           
 void setFaultDetector(FaultDetector faultDetector)
           
 void setLocationServer(LocationServer locationServer)
           
 void setRecoveryProcess(RecoveryProcess recoveryProcess)
           
 void setResourceServer(ResourceServer resourceServer)
           
 void startFailureDetector()
          Start the tread that periodically test the reachability of objects that are registred in the location server ls.
 void stopFailureDetector()
          Stop the the failure detector thread.
 int storeCheckpoint(Checkpoint c, int incarnation)
          Store a checkpoint in the checkpoint server.
 void storeReply(UniqueID receiverID, Reply reply)
          The reply passed in paramter must be synchronously logged on the server.
 void storeRequest(UniqueID receiverId, Request request)
          The request passed in paramter must be synchronously logged on the server.
 void submitJob(ActiveQueueJob job)
          to submit a job to recovery process
 JobBarrier submitJobWithBarrier(ActiveQueueJob job)
          to submit a job to recovery process, with a barrier for waiting its completion
 void suspendFailureDetector()
          Temporarily suspend the failure detector thread.
 void unregister(UniqueID id)
          Unregister the AO identified by id.
 void updateLocation(UniqueID id, UniversalBody newLocation)
          Set the new location of the active object identified by id.
 void updateState(UniqueID id, int state)
          Update the current state of the active object id.
 
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
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

DEFAULT_PORT

public static final int DEFAULT_PORT
Default server port

See Also:
Constant Field Values

DEFAULT_FDETECT_SCAN_PERIOD

public static final int DEFAULT_FDETECT_SCAN_PERIOD
Period of the failure detector sanning (ms)

See Also:
Constant Field Values

DEFAULT_SERVER_NAME

public static final java.lang.String DEFAULT_SERVER_NAME
Default name of this server

See Also:
Constant Field Values
Constructor Detail

FTServer

public FTServer()
         throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

init

public void init(FaultDetector fd,
                 LocationServer ls,
                 RecoveryProcess rp,
                 ResourceServer rs,
                 CheckpointServer cs)
Initialized server with each needed subservers


isUnreachable

public boolean isUnreachable(UniversalBody body)
                      throws java.rmi.RemoteException
Description copied from interface: FaultDetector
The fault detector test the reachability of the active object body by sending a heartbeat message to body.

Specified by:
isUnreachable in interface FaultDetector
Parameters:
body - the tested active object
Returns:
true if body is unreachable, false otherwise
Throws:
java.rmi.RemoteException
See Also:
FaultDetector.isUnreachable(org.objectweb.proactive.core.body.UniversalBody)

startFailureDetector

public void startFailureDetector()
                          throws java.rmi.RemoteException
Description copied from interface: FaultDetector
Start the tread that periodically test the reachability of objects that are registred in the location server ls. If a failure is detected, the recovery process must be noticed.

Specified by:
startFailureDetector in interface FaultDetector
Throws:
java.rmi.RemoteException
See Also:
FaultDetector.startFailureDetector()

suspendFailureDetector

public void suspendFailureDetector()
                            throws java.rmi.RemoteException
Description copied from interface: FaultDetector
Temporarily suspend the failure detector thread.

Specified by:
suspendFailureDetector in interface FaultDetector
Throws:
java.rmi.RemoteException
See Also:
FaultDetector.suspendFailureDetector()

stopFailureDetector

public void stopFailureDetector()
                         throws java.rmi.RemoteException
Description copied from interface: FaultDetector
Stop the the failure detector thread.

Specified by:
stopFailureDetector in interface FaultDetector
Throws:
java.rmi.RemoteException
See Also:
FaultDetector.stopFailureDetector()

forceDetection

public void forceDetection()
                    throws java.rmi.RemoteException
Description copied from interface: FaultDetector
Force a failure detection even if the failure detector thread is waiting.

Specified by:
forceDetection in interface FaultDetector
Throws:
java.rmi.RemoteException
See Also:
FaultDetector.forceDetection()

searchObject

public UniversalBody searchObject(UniqueID id,
                                  UniversalBody oldLocation,
                                  UniqueID caller)
                           throws java.rmi.RemoteException
Description copied from interface: LocationServer
Return the current location of object id.

Specified by:
searchObject in interface LocationServer
Parameters:
id - Unique id of the searched object
oldLocation - last known location of the searched object
Returns:
the new location of the searched object
Throws:
java.rmi.RemoteException
See Also:
LocationServer.searchObject(org.objectweb.proactive.core.UniqueID, org.objectweb.proactive.core.body.UniversalBody, org.objectweb.proactive.core.UniqueID)

updateLocation

public void updateLocation(UniqueID id,
                           UniversalBody newLocation)
                    throws java.rmi.RemoteException
Description copied from interface: LocationServer
Set the new location of the active object identified by id. Call register in the recovery process.

Specified by:
updateLocation in interface LocationServer
Parameters:
id - id of the caller
newLocation - new location of the caller. If this location is null, the body id is removed from the location table.
Throws:
java.rmi.RemoteException
See Also:
LocationServer.updateLocation(org.objectweb.proactive.core.UniqueID, org.objectweb.proactive.core.body.UniversalBody)

getAllLocations

public java.util.ArrayList getAllLocations()
                                    throws java.rmi.RemoteException
Description copied from interface: LocationServer
Return the list of locations of all registered bodies.

Specified by:
getAllLocations in interface LocationServer
Returns:
the list of locations of all registered bodies.
Throws:
java.rmi.RemoteException
See Also:
LocationServer.getAllLocations()

getLocation

public UniversalBody getLocation(UniqueID id)
                          throws java.rmi.RemoteException
Description copied from interface: LocationServer
Return the current known location of a registred body.

Specified by:
getLocation in interface LocationServer
Returns:
the current known location of a registred body.
Throws:
java.rmi.RemoteException
See Also:
LocationServer.getLocation(org.objectweb.proactive.core.UniqueID)

register

public void register(UniqueID id)
              throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
Register the calling AO. Each AO is registred on creation by newActive. Default state is RUNNING.

Specified by:
register in interface RecoveryProcess
Parameters:
id - the registered body id
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.register(org.objectweb.proactive.core.UniqueID)

unregister

public void unregister(UniqueID id)
                throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
Unregister the AO identified by id.

Specified by:
unregister in interface RecoveryProcess
Parameters:
id - the unregistered body id
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.unregister(org.objectweb.proactive.core.UniqueID)

failureDetected

public void failureDetected(UniqueID id)
                     throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
Notify the recovery process that the body passed in paramater is suspected to be failed.

Specified by:
failureDetected in interface RecoveryProcess
Parameters:
id - the id of the suspected AO
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.failureDetected(org.objectweb.proactive.core.UniqueID)

updateState

public void updateState(UniqueID id,
                        int state)
                 throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
Update the current state of the active object id. Its state can be failed, recovering or running.

Specified by:
updateState in interface RecoveryProcess
Parameters:
id - id of the AO to update
state - state of the active object
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.updateState(org.objectweb.proactive.core.UniqueID, int)

getSystemSize

public int getSystemSize()
                  throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
Return the size of the system, i.e. the number of registred bodies.

Specified by:
getSystemSize in interface RecoveryProcess
Returns:
the number of registred bodies
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.getSystemSize()

submitJob

public void submitJob(ActiveQueueJob job)
               throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
to submit a job to recovery process

Specified by:
submitJob in interface RecoveryProcess
Parameters:
job - the job to submit
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.submitJob(org.objectweb.proactive.core.body.ft.servers.util.ActiveQueueJob)

submitJobWithBarrier

public JobBarrier submitJobWithBarrier(ActiveQueueJob job)
                                throws java.rmi.RemoteException
Description copied from interface: RecoveryProcess
to submit a job to recovery process, with a barrier for waiting its completion

Specified by:
submitJobWithBarrier in interface RecoveryProcess
Parameters:
job - the job to submit
Returns:
the barrier on which waiting for the completion of the job
Throws:
java.rmi.RemoteException
See Also:
RecoveryProcess.submitJobWithBarrier(org.objectweb.proactive.core.body.ft.servers.util.ActiveQueueJob)

addFreeNode

public void addFreeNode(Node n)
                 throws java.rmi.RemoteException
Description copied from interface: ResourceServer
Add a new node usable for recovery.

Specified by:
addFreeNode in interface ResourceServer
Parameters:
n - the node to add
Throws:
java.rmi.RemoteException
See Also:
ResourceServer.addFreeNode(org.objectweb.proactive.core.node.Node)

getFreeNode

public Node getFreeNode()
                 throws java.rmi.RemoteException
Description copied from interface: ResourceServer
Return the next available node for recovery

Specified by:
getFreeNode in interface ResourceServer
Returns:
an available node
Throws:
java.rmi.RemoteException
See Also:
ResourceServer.getFreeNode()

storeCheckpoint

public int storeCheckpoint(Checkpoint c,
                           int incarnation)
                    throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Store a checkpoint in the checkpoint server.

Specified by:
storeCheckpoint in interface CheckpointServer
Parameters:
c - the checkpoint to stored
incarnation - incarnation number of the caller
Returns:
the last global state of the system, i.e. the index of the latest completed image of the system.
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.storeCheckpoint(org.objectweb.proactive.core.body.ft.checkpointing.Checkpoint, int)

getCheckpoint

public Checkpoint getCheckpoint(UniqueID id,
                                int sequenceNumber)
                         throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Return a checkpoint of the object identified by id.

Specified by:
getCheckpoint in interface CheckpointServer
Parameters:
id - the owner of the returned checkpoint
sequenceNumber - the index of the requiered checkpoint
Returns:
a checkpoint of the object identified by id
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.getCheckpoint(org.objectweb.proactive.core.UniqueID, int)

getLastCheckpoint

public Checkpoint getLastCheckpoint(UniqueID id)
                             throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Return the latest checkpoint of the object identified by id

Specified by:
getLastCheckpoint in interface CheckpointServer
Parameters:
id - the owner of the returned checkpoint
Returns:
the latest checkpoint of the object identified by id
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.getLastCheckpoint(org.objectweb.proactive.core.UniqueID)

addInfoToCheckpoint

public void addInfoToCheckpoint(CheckpointInfo ci,
                                UniqueID id,
                                int sequenceNumber,
                                int incarnation)
                         throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Add informations to an already stored checkpoint

Specified by:
addInfoToCheckpoint in interface CheckpointServer
Parameters:
ci - informations that have to be added
id - owner of the considered checkpoint
sequenceNumber - index of the considered checkpoint
incarnation - incarnation number of the caller
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.addInfoToCheckpoint(org.objectweb.proactive.core.body.ft.checkpointing.CheckpointInfo, org.objectweb.proactive.core.UniqueID, int, int)

getInfoFromCheckpoint

public CheckpointInfo getInfoFromCheckpoint(UniqueID id,
                                            int sequenceNumber)
                                     throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Return informations on the given checkpoint

Specified by:
getInfoFromCheckpoint in interface CheckpointServer
Parameters:
id - owner of the considered checkpoint
sequenceNumber - index of the considered checkpoint
Returns:
informations on the given checkpoint
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.getInfoFromCheckpoint(org.objectweb.proactive.core.UniqueID, int)

commitHistory

public void commitHistory(HistoryUpdater rh)
                   throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Add an history to a checkpoint. Informations about the corresponding checkpoint are stored in the HistoryUpdater object.

Specified by:
commitHistory in interface CheckpointServer
Parameters:
rh - the history updater.
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.commitHistory(org.objectweb.proactive.core.body.ft.message.HistoryUpdater)

outputCommit

public void outputCommit(MessageInfo mi)
                  throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
The state of the system must be commited before the sent of the message linked to the messageInfo mi.

Specified by:
outputCommit in interface CheckpointServer
Parameters:
mi - the message information linked to the message that is sent to the outside world
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.outputCommit(org.objectweb.proactive.core.body.ft.message.MessageInfo)

getServerCodebase

public java.lang.String getServerCodebase()
                                   throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
Return the URL of the classServer linked to this checkpointServer. This classServer is used by recovering active objects

Specified by:
getServerCodebase in interface CheckpointServer
Returns:
the URL of the classServer linked to this checkpointServer
Throws:
java.rmi.RemoteException
See Also:
CheckpointServer.getServerCodebase()

storeRequest

public void storeRequest(UniqueID receiverId,
                         Request request)
                  throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
The request passed in paramter must be synchronously logged on the server. It must be associated with the ID passed in parameter.

Specified by:
storeRequest in interface CheckpointServer
Parameters:
receiverId - the ID associated to the request.
request - the request to log.
Throws:
java.rmi.RemoteException - If communication with server fails.
See Also:
CheckpointServer.storeRequest(org.objectweb.proactive.core.UniqueID, org.objectweb.proactive.core.body.request.Request)

storeReply

public void storeReply(UniqueID receiverID,
                       Reply reply)
                throws java.rmi.RemoteException
Description copied from interface: CheckpointServer
The reply passed in paramter must be synchronously logged on the server. It must be associated with the ID passed in parameter.

Specified by:
storeReply in interface CheckpointServer
Parameters:
receiverID - the ID associated to the reply.
reply - the reply to log.
Throws:
java.rmi.RemoteException - If communication with server fails.
See Also:
CheckpointServer.storeReply(org.objectweb.proactive.core.UniqueID, org.objectweb.proactive.core.body.reply.Reply)

getCheckpointServer

public CheckpointServer getCheckpointServer()
Returns:
Returns the checkpointServer.

setCheckpointServer

public void setCheckpointServer(CheckpointServer checkpointServer)
Parameters:
checkpointServer - The checkpointServer to set.

getFaultDetector

public FaultDetector getFaultDetector()
Returns:
Returns the faultDetector.

setFaultDetector

public void setFaultDetector(FaultDetector faultDetector)
Parameters:
faultDetector - The faultDetector to set.

getLocationServer

public LocationServer getLocationServer()
Returns:
Returns the locationServer.

setLocationServer

public void setLocationServer(LocationServer locationServer)
Parameters:
locationServer - The locationServer to set.

getRecoveryProcess

public RecoveryProcess getRecoveryProcess()
Returns:
Returns the recoveryProcess.

setRecoveryProcess

public void setRecoveryProcess(RecoveryProcess recoveryProcess)
Parameters:
recoveryProcess - The recoveryProcess to set.

getResourceServer

public ResourceServer getResourceServer()
Returns:
Returns the resourceServer.

setResourceServer

public void setResourceServer(ResourceServer resourceServer)
Parameters:
resourceServer - The resourceServer to set.

initialize

public void initialize()
                throws java.rmi.RemoteException
Description copied from interface: FaultDetector
Reinit the state of the fault detector

Specified by:
initialize in interface FaultDetector
Throws:
java.rmi.RemoteException
See Also:
LocationServer.initialize()


Copyright 2001-2005 INRIA All Rights Reserved.