org.ourgrid.mygrid.replicaexecutor
Class EBReplicaExecutorFacade

java.lang.Object
  extended by org.ourgrid.mygrid.replicaexecutor.EBReplicaExecutorFacade
Direct Known Subclasses:
FakeEBReplicaExecutorFacade

public class EBReplicaExecutorFacade
extends java.lang.Object

Description: This class is responsible for queueing events in the ReplicaExecutorEventEngine. All communication with objects inside the ReplicaExecutorEventEngine is made through this facade.


Constructor Summary
EBReplicaExecutorFacade()
          Creates a EBReplicaExecutorFacade
 
Method Summary
 void cancelReplicasOfJob(int jobId)
          Cancel all replicas of a given Job
 void config(EBSchedulerFacade ebSchedulerFacade)
          Configures the EBReplicaExecutorFacade by setting the EBSchedulerFacade.
 void config(ReplicaExecutorEventEngine replicaExecutorEventProcessor)
          Configures the EBReplicaExecutorFacade by setting the ReplicaExecutorEventEngine.
 void executeReplica(ReplicaEntry replica, GumClient gumClient)
          Executes a given Replica with a specified GridMachine
 ReplicaExecutorEventEngine getEventProcessor()
           
protected  long getNumberOfAbortedReplicas()
           
protected  long getNumberOfCancelledReplicas()
           
protected  long getNumberOfFailedReplicas()
           
protected  long getNumberOfFinishedReplicas()
           
protected  long getNumberOfRunningReplicas()
           
 void replicaAborted(ReplicaEntry replica)
          Notifies the replica executor module that a given replica has been aborted.
 void replicaCanceled(ReplicaEntry replica)
          Notifies the replica executor module that a given replica has been cancelled.
protected  void replicaFailed(ReplicaEntry replica)
          Notifies the replica executor module that a given replica has failed
protected  void replicaFinished(ReplicaEntry replica)
          Notifies the replica executor module that a given replica has finished.
protected  EventQueue<ResponseEvent<java.lang.Boolean>> requestPermission(ReplicaEntry replica)
          Request permission to access the task's critical region.
 EventQueue<ShutdownResponseEvent> shutdown()
          Shuts down the facade.
 void startEventProcessor()
          Starts the ReplicaExecutorEventEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EBReplicaExecutorFacade

public EBReplicaExecutorFacade()
Creates a EBReplicaExecutorFacade

Method Detail

executeReplica

public void executeReplica(ReplicaEntry replica,
                           GumClient gumClient)
Executes a given Replica with a specified GridMachine

Parameters:
replica - The replica to be executed
gumClient - The grid machine where the replica should be executed

cancelReplicasOfJob

public void cancelReplicasOfJob(int jobId)
Cancel all replicas of a given Job

Parameters:
jobId - The id of the job whose replicas should be canceled.

replicaFailed

protected void replicaFailed(ReplicaEntry replica)
Notifies the replica executor module that a given replica has failed

Parameters:
replica - The replica who has failed.

replicaFinished

protected void replicaFinished(ReplicaEntry replica)
Notifies the replica executor module that a given replica has finished.

Parameters:
replica - The replica who has finished.

replicaAborted

public void replicaAborted(ReplicaEntry replica)
Notifies the replica executor module that a given replica has been aborted.

Parameters:
replica - The replica who has been been aborted.

replicaCanceled

public void replicaCanceled(ReplicaEntry replica)
Notifies the replica executor module that a given replica has been cancelled.

Parameters:
replica - The replica who has been cancelled.

requestPermission

protected EventQueue<ResponseEvent<java.lang.Boolean>> requestPermission(ReplicaEntry replica)
Request permission to access the task's critical region.

Parameters:
replica - The replica who wants to access it's task's critical region.
Returns:
An EventQueue that will contain the result of the permission request.

config

public void config(EBSchedulerFacade ebSchedulerFacade)
Configures the EBReplicaExecutorFacade by setting the EBSchedulerFacade.

Parameters:
ebSchedulerFacade - The EBSchedulerFacade

config

public void config(ReplicaExecutorEventEngine replicaExecutorEventProcessor)
Configures the EBReplicaExecutorFacade by setting the ReplicaExecutorEventEngine.

Parameters:
replicaExecutorEventProcessor - The ReplicaExecutorEventEngine

getEventProcessor

public ReplicaExecutorEventEngine getEventProcessor()
Returns:
The ReplicaExecutroEventProcessor

startEventProcessor

public void startEventProcessor()
Starts the ReplicaExecutorEventEngine


shutdown

public EventQueue<ShutdownResponseEvent> shutdown()
Shuts down the facade.


getNumberOfCancelledReplicas

protected long getNumberOfCancelledReplicas()
Returns:
Returns the number of replicas cancelled.

getNumberOfFailedReplicas

protected long getNumberOfFailedReplicas()
Returns:
Returns the the number of replicas failed.

getNumberOfFinishedReplicas

protected long getNumberOfFinishedReplicas()
Returns:
Returns the number of replicas Finished.

getNumberOfAbortedReplicas

protected long getNumberOfAbortedReplicas()
Returns:
Returns the number of replicas Aborted.

getNumberOfRunningReplicas

protected long getNumberOfRunningReplicas()
Returns:
Returns the number of replicas running.