org.ourgrid.mygrid.scheduler.jobmanager
Class AbstractJobManager

java.lang.Object
  extended by org.ourgrid.mygrid.scheduler.jobmanager.AbstractJobManager
All Implemented Interfaces:
JobManager
Direct Known Subclasses:
EBJobManager

public abstract class AbstractJobManager
extends java.lang.Object
implements JobManager


Constructor Summary
AbstractJobManager()
           
 
Method Summary
 void addJob(int jobId, JobSpec jobSpec)
          Adds a new Job.
 void addNewListener(JobManagerListenerRemote newListener)
           
 ReplicaEntry createNewReplica(TaskEntry task)
           
protected abstract  void realAddJob(int jobId, JobSpec jobSpec)
           
protected abstract  ReplicaEntry realCreateNewReplica(TaskEntry task)
           
protected abstract  void realRemoveJob(int jobId)
           
protected abstract  void realReplicaAborted(ReplicaExecutorResult result)
           
protected abstract  void realReplicaCanceled(ReplicaExecutorResult result)
           
protected abstract  void realReplicaFailed(ReplicaExecutorResult result)
           
protected abstract  void realReplicaFinished(ReplicaExecutorResult result)
           
protected abstract  void realReplicaRunning(ReplicaEntry replica, GumID gumID)
           
protected abstract  void realSetCanceled(int jobId)
           
protected abstract  void realShutdown()
           
 void removeJob(int jobId)
          Remove the information about the specified job
 void removeListener(JobManagerListenerRemote listener)
           
 void replicaAborted(ReplicaExecutorResult result)
          Sets the Replica state to aborted.
 void replicaCanceled(ReplicaExecutorResult result)
          Sets the Replica state to canceled.
 void replicaFailed(ReplicaExecutorResult result)
          Sets the Replica state to failed.
 void replicaFinished(ReplicaExecutorResult result)
          Sets the Replica state to finished.
 void replicaRunning(ReplicaEntry replica, GumID gumID)
           
 void setCanceled(int jobId)
          Sets the given job as canceled.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ourgrid.mygrid.scheduler.jobmanager.JobManager
addJobInterested, cleanFinishedJobs, clonedJobList, getJobById, getJobState, jobList, setMaxFails, setMaxReplicas
 

Constructor Detail

AbstractJobManager

public AbstractJobManager()
Method Detail

addJob

public void addJob(int jobId,
                   JobSpec jobSpec)
Description copied from interface: JobManager
Adds a new Job.

Specified by:
addJob in interface JobManager
jobSpec - The job specification.

createNewReplica

public ReplicaEntry createNewReplica(TaskEntry task)
Specified by:
createNewReplica in interface JobManager

realCreateNewReplica

protected abstract ReplicaEntry realCreateNewReplica(TaskEntry task)

replicaFinished

public void replicaFinished(ReplicaExecutorResult result)
Description copied from interface: JobManager
Sets the Replica state to finished. It also notifies JobInteresteds case it is necessary.

Specified by:
replicaFinished in interface JobManager
Parameters:
result - The ReplicaExecutorResult.

replicaFailed

public void replicaFailed(ReplicaExecutorResult result)
Description copied from interface: JobManager
Sets the Replica state to failed. It also notifies JobInteresteds case it is necessary.

Specified by:
replicaFailed in interface JobManager
Parameters:
result - The ReplicaExecutorResult.

replicaAborted

public void replicaAborted(ReplicaExecutorResult result)
Description copied from interface: JobManager
Sets the Replica state to aborted. It also notifies JobInteresteds case it is necessary.

Specified by:
replicaAborted in interface JobManager
Parameters:
result - The ReplicaExecutorResult.

replicaCanceled

public void replicaCanceled(ReplicaExecutorResult result)
Description copied from interface: JobManager
Sets the Replica state to canceled. It also notifies JobInteresteds case it is necessary.

Specified by:
replicaCanceled in interface JobManager
Parameters:
result - The ReplicaExecutorResult.

setCanceled

public void setCanceled(int jobId)
                 throws JobNotFoundException,
                        JobCouldNotBeCancelledException
Description copied from interface: JobManager
Sets the given job as canceled.

Specified by:
setCanceled in interface JobManager
Parameters:
jobId - The job identification
Throws:
JobNotFoundException - when the job was not found
JobCouldNotBeCancelledException - when the job could not be canceled

removeJob

public void removeJob(int jobId)
               throws JobCannotBeRemovedException
Description copied from interface: JobManager
Remove the information about the specified job

Specified by:
removeJob in interface JobManager
Throws:
JobCannotBeRemovedException

replicaRunning

public void replicaRunning(ReplicaEntry replica,
                           GumID gumID)
Specified by:
replicaRunning in interface JobManager

realReplicaRunning

protected abstract void realReplicaRunning(ReplicaEntry replica,
                                           GumID gumID)

shutdown

public void shutdown()
Specified by:
shutdown in interface JobManager

realShutdown

protected abstract void realShutdown()

addNewListener

public void addNewListener(JobManagerListenerRemote newListener)
Specified by:
addNewListener in interface JobManager

removeListener

public void removeListener(JobManagerListenerRemote listener)
Specified by:
removeListener in interface JobManager

realAddJob

protected abstract void realAddJob(int jobId,
                                   JobSpec jobSpec)

realReplicaFinished

protected abstract void realReplicaFinished(ReplicaExecutorResult result)

realReplicaFailed

protected abstract void realReplicaFailed(ReplicaExecutorResult result)

realReplicaAborted

protected abstract void realReplicaAborted(ReplicaExecutorResult result)

realReplicaCanceled

protected abstract void realReplicaCanceled(ReplicaExecutorResult result)

realSetCanceled

protected abstract void realSetCanceled(int jobId)
                                 throws JobNotFoundException,
                                        JobCouldNotBeCancelledException
Throws:
JobNotFoundException
JobCouldNotBeCancelledException

realRemoveJob

protected abstract void realRemoveJob(int jobId)
                               throws JobCannotBeRemovedException
Throws:
JobCannotBeRemovedException