org.ourgrid.mygrid.scheduler
Class EBSchedulerFacade

java.lang.Object
  extended by org.ourgrid.mygrid.scheduler.EBSchedulerFacade
Direct Known Subclasses:
FakeEBSchedulerFacade

public class EBSchedulerFacade
extends java.lang.Object

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


Field Summary
protected  SchedulerEventEngine schedulerEventProcessor
          The SchedulerEventProcessor.
 
Constructor Summary
EBSchedulerFacade()
          The constructor.
 
Method Summary
 int addJob(JobSpec newJobSpec)
          Adds a new Job.
 EventQueue<NotifyEvent> cancelJob(int jobId)
          Cancels a specified Job.
 EventQueue<NotifyEvent> cleanFinishedJobs()
          Clean the list of terminated jobs
 void config(EBReplicaExecutorFacade ebReplicaExecutorFacade)
          Configures the EBSchedulerFacade.
protected  SchedulerEventEngine createSchedulerEventEngine(Scheduler scheduler, GumpManager gumpManager, GumpClient gumpClient, EBReplicaExecutorFacade ebReplicaExecutorFacade)
           
 SchedulerEventEngine getEventProcessor()
           
 EventQueue<ResponseEvent<java.util.Collection<GridManagerEntry>>> getGumEntries(GridManagerListenerRemote newListener)
          Gets all GridMachine s from the EBGridManager.
 EventQueue<ResponseEvent<java.util.Collection<GumSpec>>> getGumSpecs()
           
 EventQueue<ResponseEvent<java.util.Collection<PeerEntry>>> getPeerEntries(GridManagerListenerRemote newListener)
          Gets all GridMachineProvider's specifications from the EBGridManager.
 void gumIsDead(long requestId, GumID gumID)
          Notifies that a GridMachine is dead.
 void hereIsGum(GumClient gumClient, long requestid, ObjectID peerBrokerAccessID)
          Delivers an available grid machine to the scheduler
 EventQueue<ResponseEvent<java.util.Collection<JobEntry>>> jobList(JobManagerListenerRemote newListener)
          Provides the list of Jobs.
 void peerAlive(PeerSpec peerSpec)
          Notifies EBGridManager that the peer PeerSpec is alive.
 void peerIsDead(PeerSpec peerSpec)
          Notifies EBGridManager that the peer PeerSpec is dead.
 void removeGridManagerListener(GridManagerListenerRemote listener)
           
 EventQueue<ResponseEvent> removeJob(int jobId)
          Remove the information about the specified job
 void removeJobManagerListener(JobManagerListenerRemote listener)
           
 void replicaAborted(ReplicaExecutorResult result)
          Notifies that a task replica has been aborted.
 void replicaCanceled(ReplicaExecutorResult result)
          Notifies that a task replica has canceled.
 void replicaFailed(ReplicaExecutorResult result)
          Notifies that a task replica has failed.
 void replicaFinished(ReplicaExecutorResult result)
          Notifies that a task replica has finished.
 void setPeers(java.util.Collection<PeerSpec> peerSpecs)
          Sets all GridMachineProviders to be used by the Scheduler.
 EventQueue<ShutdownResponseEvent> shutdown()
          Shuts down the facade.
 void startEventProcessor()
          Starts the SchedulerEventProcessor
 EventQueue<Event> waitForJob(int jobId)
          Provides an EventQueue that will only have an element when the specified Job reaches a terminal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schedulerEventProcessor

protected SchedulerEventEngine schedulerEventProcessor
The SchedulerEventProcessor.

Constructor Detail

EBSchedulerFacade

public EBSchedulerFacade()
The constructor.

Method Detail

startEventProcessor

public void startEventProcessor()
Starts the SchedulerEventProcessor


config

public void config(EBReplicaExecutorFacade ebReplicaExecutorFacade)
            throws ConfigException,
                   java.rmi.RemoteException
Configures the EBSchedulerFacade. Creates the RMI objects that will be accessed by other modules and creates the scheduler event engine.

Throws:
ConfigException
java.rmi.RemoteException

createSchedulerEventEngine

protected SchedulerEventEngine createSchedulerEventEngine(Scheduler scheduler,
                                                          GumpManager gumpManager,
                                                          GumpClient gumpClient,
                                                          EBReplicaExecutorFacade ebReplicaExecutorFacade)
                                                   throws ConfigException
Throws:
ConfigException

jobList

public EventQueue<ResponseEvent<java.util.Collection<JobEntry>>> jobList(JobManagerListenerRemote newListener)
Provides the list of Jobs.

Parameters:
newListener - TODO
Returns:
An EventQueue were the list of jobs will be put.

waitForJob

public EventQueue<Event> waitForJob(int jobId)
Provides an EventQueue that will only have an element when the specified Job reaches a terminal state.

Parameters:
jobId - The Job identification.
Returns:
A response EventQueue that will receive an event when the specified Job reaches a terminal state.

cancelJob

public EventQueue<NotifyEvent> cancelJob(int jobId)
Cancels a specified Job.

Parameters:
jobId - The Job identification.

cleanFinishedJobs

public EventQueue<NotifyEvent> cleanFinishedJobs()
Clean the list of terminated jobs

Returns:
the response queue

removeJob

public EventQueue<ResponseEvent> removeJob(int jobId)
Remove the information about the specified job

Parameters:
jobId -
Returns:
the response queue

addJob

public int addJob(JobSpec newJobSpec)
Adds a new Job.

Parameters:
newJobSpec - The Job specification.
Returns:
An EventQueue that will contain the Job identification.

hereIsGum

public void hereIsGum(GumClient gumClient,
                      long requestid,
                      ObjectID peerBrokerAccessID)
Delivers an available grid machine to the scheduler

Parameters:
gumClient - a reference to the grid machine.
requestid - identification of the request that will receive the gum
peerBrokerAccessID - an id to the grid machine provider (peer) to which the machine will be given back after execution

replicaFinished

public void replicaFinished(ReplicaExecutorResult result)
Notifies that a task replica has finished.

Parameters:
result - The ReplicaExecutorResult.

replicaFailed

public void replicaFailed(ReplicaExecutorResult result)
Notifies that a task replica has failed.

Parameters:
result - The ReplicaExecutorResult.

replicaAborted

public void replicaAborted(ReplicaExecutorResult result)
Notifies that a task replica has been aborted.

Parameters:
result - The ReplicaExecutorResult.

replicaCanceled

public void replicaCanceled(ReplicaExecutorResult result)
Notifies that a task replica has canceled.

Parameters:
result - The ReplicaExecutorResult.

gumIsDead

public void gumIsDead(long requestId,
                      GumID gumID)
Notifies that a GridMachine is dead.

Parameters:
requestId - The request identification
gumID - The GridMachine that is dead

getGumEntries

public EventQueue<ResponseEvent<java.util.Collection<GridManagerEntry>>> getGumEntries(GridManagerListenerRemote newListener)
Gets all GridMachine s from the EBGridManager.

Parameters:
newListener - TODO
Returns:
An EventQueue containing a ResponseEvent whose response value is a list of GridMachineExtended objects.

getGumSpecs

public EventQueue<ResponseEvent<java.util.Collection<GumSpec>>> getGumSpecs()

getPeerEntries

public EventQueue<ResponseEvent<java.util.Collection<PeerEntry>>> getPeerEntries(GridManagerListenerRemote newListener)
Gets all GridMachineProvider's specifications from the EBGridManager.

Returns:
An EventQueue containing a ResponseEvent whose response value is a list of GuMPSpec objects.

removeJobManagerListener

public void removeJobManagerListener(JobManagerListenerRemote listener)

removeGridManagerListener

public void removeGridManagerListener(GridManagerListenerRemote listener)

setPeers

public void setPeers(java.util.Collection<PeerSpec> peerSpecs)
Sets all GridMachineProviders to be used by the Scheduler.

Parameters:
peerSpecs - The new list of GridMachineProviders specifications

peerAlive

public void peerAlive(PeerSpec peerSpec)
Notifies EBGridManager that the peer PeerSpec is alive.

Parameters:
peerSpec -

peerIsDead

public void peerIsDead(PeerSpec peerSpec)
Notifies EBGridManager that the peer PeerSpec is dead.

Parameters:
peerSpec -

shutdown

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


getEventProcessor

public SchedulerEventEngine getEventProcessor()