org.ourgrid.mygrid.scheduler
Class SchedulerImpl

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.mygrid.scheduler.SchedulerImpl
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, Scheduler

public class SchedulerImpl
extends OurgridUnicastRemoteObject
implements Scheduler

The Scheduler remote object responsible for receiving RMI calls and translating them to calls on the EBSchedulerFacade.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected SchedulerImpl(EBSchedulerFacade ebSchedulerFacade)
          The constructor.
  SchedulerImpl(EBSchedulerFacade ebSchedulerFacade, MGSecureClientSocketFactory secureClientSocketFactory, MGSecureServerSocketFactory secureServerSocketFactory, int securePort)
          The constructor with SecureSocketFactories.
 
Method Summary
 int addJob(JobSpec jobSpec)
          Adds a new job to the scheduler.
 void cancelJob(int jobId)
          Cancels a job specified by jobId parameter.
 void cleanFinishedJobs()
          Clean all jobs that are not Running and will not run anymore.
 java.util.Collection<GridManagerEntry> getGumEntries(GridManagerListenerRemote newListener)
          Provides information about the gums currently in use by the scheduler
 java.util.Collection<GumSpec> getGumSpecs()
          Provides information about the gums currently in use by the scheduler
 java.util.Collection<JobEntry> jobList(JobManagerListenerRemote newListener)
          Gives access to the list of jobs on the scheduler.
 void removeGridManagerListener(GridManagerListenerRemote listener)
           
 void removeJob(int jobId)
          Remove the information about the specified job
 void removeJobManagerListener(JobManagerListenerRemote listener)
           
 void waitForJob(int jobId)
          Puts the calling thread to wait until a certain job is finished.
 
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

SchedulerImpl

protected SchedulerImpl(EBSchedulerFacade ebSchedulerFacade)
                 throws java.rmi.RemoteException
The constructor.

Parameters:
ebSchedulerFacade - The EBSchedulerFacade
Throws:
java.rmi.RemoteException

SchedulerImpl

public SchedulerImpl(EBSchedulerFacade ebSchedulerFacade,
                     MGSecureClientSocketFactory secureClientSocketFactory,
                     MGSecureServerSocketFactory secureServerSocketFactory,
                     int securePort)
              throws java.rmi.RemoteException
The constructor with SecureSocketFactories.

Parameters:
ebSchedulerFacade - The EBSchedulerFacade
secureClientSocketFactory - The SecureClientSocketFactory.
secureServerSocketFactory - The SecureServerSocketFactory.
securePort - The port where the secure services will be bound.
Throws:
java.rmi.RemoteException
Method Detail

jobList

public java.util.Collection<JobEntry> jobList(JobManagerListenerRemote newListener)
                                       throws java.rmi.RemoteException
Description copied from interface: Scheduler
Gives access to the list of jobs on the scheduler.

Specified by:
jobList in interface Scheduler
Parameters:
newListener - TODO
Returns:
The list within all the jobs on the scheduler
Throws:
java.rmi.RemoteException
See Also:
Scheduler.jobList(JobManagerListenerRemote)

waitForJob

public void waitForJob(int jobId)
                throws JobNotFoundException,
                       java.rmi.RemoteException
Description copied from interface: Scheduler
Puts the calling thread to wait until a certain job is finished.

Specified by:
waitForJob in interface Scheduler
Parameters:
jobId - The identifier of the job the thread must wait for. This identifier is obtained when the job is added to the scheduler.
Throws:
JobNotFoundException - if there is no job with this id
java.rmi.RemoteException - if any exception occurs while contacting with this remote object.
See Also:
Scheduler.waitForJob(int)

cancelJob

public void cancelJob(int jobId)
               throws JobNotFoundException,
                      JobCouldNotBeCancelledException,
                      java.rmi.RemoteException
Description copied from interface: Scheduler
Cancels a job specified by jobId parameter. Canceling a job implies on interrupt the running tasks and consider all the ready and running tasks as canceled tasks. Once a job is canceled, it must not be scheduled again.

Specified by:
cancelJob in interface Scheduler
Parameters:
jobId - The identification of the job to be canceled.
Throws:
JobNotFoundException - If the job specified by jobId does not exist.
JobCouldNotBeCancelledException - If asked to cancel a job that canot be cancelled anymore.
java.rmi.RemoteException - If there is a communication exception during the execution of a remote method call.
See Also:
Scheduler.cancelJob(int)

addJob

public int addJob(JobSpec jobSpec)
           throws java.rmi.RemoteException
Description copied from interface: Scheduler
Adds a new job to the scheduler.

Specified by:
addJob in interface Scheduler
Parameters:
jobSpec - The JobInfo object that describes the job to be added.
Returns:
the identifier of this job for the scheduler. This identifier can be used in the waitForJob method.
Throws:
java.rmi.RemoteException - If there is a communication exception during the execution of a remote method call.
See Also:
Scheduler.addJob(JobSpec)

cleanFinishedJobs

public void cleanFinishedJobs()
                       throws java.rmi.RemoteException
Description copied from interface: Scheduler
Clean all jobs that are not Running and will not run anymore.

Specified by:
cleanFinishedJobs in interface Scheduler
Throws:
java.rmi.RemoteException - If there is a communication exception during the execution of a remote method call.
See Also:
Scheduler.cleanFinishedJobs()

removeJob

public void removeJob(int jobId)
               throws JobCannotBeRemovedException,
                      java.rmi.RemoteException
Description copied from interface: Scheduler
Remove the information about the specified job

Specified by:
removeJob in interface Scheduler
Throws:
JobCannotBeRemovedException
java.rmi.RemoteException - if there is a communication exception during the execution of a remote method call.
See Also:
Scheduler.removeJob(int)

getGumEntries

public java.util.Collection<GridManagerEntry> getGumEntries(GridManagerListenerRemote newListener)
                                                     throws java.rmi.RemoteException
Description copied from interface: Scheduler
Provides information about the gums currently in use by the scheduler

Specified by:
getGumEntries in interface Scheduler
Returns:
a collection with the EBGridManager entries
Throws:
java.rmi.RemoteException - if there is a communication exception during the execution of a remote method call.

getGumSpecs

public java.util.Collection<GumSpec> getGumSpecs()
                                          throws java.rmi.RemoteException
Description copied from interface: Scheduler
Provides information about the gums currently in use by the scheduler

Specified by:
getGumSpecs in interface Scheduler
Returns:
a collection with the gums specifications
Throws:
java.rmi.RemoteException - if there is a communication exception during the execution of a remote method call.

removeJobManagerListener

public void removeJobManagerListener(JobManagerListenerRemote listener)
                              throws java.rmi.RemoteException
Specified by:
removeJobManagerListener in interface Scheduler
Throws:
java.rmi.RemoteException

removeGridManagerListener

public void removeGridManagerListener(GridManagerListenerRemote listener)
                               throws java.rmi.RemoteException
Specified by:
removeGridManagerListener in interface Scheduler
Throws:
java.rmi.RemoteException