Package org.jppf.server.job
Class JPPFJobManager
java.lang.Object
org.jppf.server.job.JPPFJobManager
- All Implemented Interfaces:
org.jppf.job.JobNotificationEmitter,org.jppf.job.JobTasksListenerManager,ServerJobChangeListener
public class JPPFJobManager
extends Object
implements ServerJobChangeListener, org.jppf.job.JobNotificationEmitter, org.jppf.job.JobTasksListenerManager
Instances of this class manage and monitor the jobs throughout their processing within the JPPF driver.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJobManagerListener(org.jppf.job.JobManagerListener listener) Add a listener to the list of listeners.voidaddJobTasksListener(org.jppf.job.JobTasksListener listener) Add a listener to the list of dispatch listeners.voidclose()Close this job manager and release its resources.voidfireJobEvent(org.jppf.job.JobNotification event) Fire job listener event.String[]Get the set of ids for all the jobs currently queued or executing.getNodesForJob(String jobUuid) Get all the nodes to which a all or part of a job is dispatched.intGet the count of notifications in the executor's quueue.intPeak count of notifications in the executor's quueue.static booleanDetermine whether the specified job is the dispatch of a broadcast job to a node.voidjobDispatched(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle) Called when all or part of a job is dispatched to a node.voidCalled when a job is complete and returned to the client.voidCalled when a job is added to the server queue.voidjobResultsReceived(org.jppf.execute.ExecutorChannel<?> channel, ServerJob job, Collection<ServerTask> tasks) Called when final tasks results have been received and are about to be sent back to the client.voidjobReturned(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle) Called when all or part of a job has returned from a node.voidjobStatusChanged(AbstractServerJob source, SubmissionStatus oldValue, SubmissionStatus newValue) Called when job submission status is changed.voidjobUpdated(AbstractServerJob job, boolean headerUpdated) Called when a job is added to the server queue.voidLoad all the dispatch listeners defined in the classpath with SPI.voidremoveJobManagerListener(org.jppf.job.JobManagerListener listener) Remove a listener from the list of listeners.voidremoveJobTasksListener(org.jppf.job.JobTasksListener listener) Remove a listener from the list of dispatch listeners.
-
Constructor Details
-
JPPFJobManager
Default constructor.- Parameters:
driver- reference to the JPPF driver.
-
-
Method Details
-
getNodesForJob
Get all the nodes to which a all or part of a job is dispatched.- Parameters:
jobUuid- the id of the job.- Returns:
- a list of
ChannelJobPairinstances.
-
getAllJobIds
Get the set of ids for all the jobs currently queued or executing.- Returns:
- an array of ids as strings.
-
jobDispatched
public void jobDispatched(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle) Description copied from interface:ServerJobChangeListenerCalled when all or part of a job is dispatched to a node.- Specified by:
jobDispatchedin interfaceServerJobChangeListener- Parameters:
serverJob- the dispatched job.channel- the node to which the job is dispatched.nodeBundle- the bundle for job event.
-
jobReturned
public void jobReturned(AbstractServerJob serverJob, org.jppf.execute.ExecutorChannel<?> channel, ServerTaskBundleNode nodeBundle) Description copied from interface:ServerJobChangeListenerCalled when all or part of a job has returned from a node.- Specified by:
jobReturnedin interfaceServerJobChangeListener- Parameters:
serverJob- the returned job.channel- the node to which the job is dispatched.nodeBundle- the bundle for job event.
-
jobQueued
Called when a job is added to the server queue.- Parameters:
serverJob- the queued job.
-
jobEnded
Called when a job is complete and returned to the client.- Parameters:
serverJob- the completed job.
-
jobUpdated
Description copied from interface:ServerJobChangeListenerCalled when a job is added to the server queue.- Specified by:
jobUpdatedin interfaceServerJobChangeListener- Parameters:
job- the updated job.headerUpdated- whether the job header(aTaskBundleinstance) has been updated.
-
jobStatusChanged
public void jobStatusChanged(AbstractServerJob source, SubmissionStatus oldValue, SubmissionStatus newValue) Description copied from interface:ServerJobChangeListenerCalled when job submission status is changed.- Specified by:
jobStatusChangedin interfaceServerJobChangeListener- Parameters:
source- the updated job.oldValue- value before change.newValue- value after change.
-
close
public void close()Close this job manager and release its resources. -
addJobManagerListener
public void addJobManagerListener(org.jppf.job.JobManagerListener listener) Add a listener to the list of listeners.- Parameters:
listener- the listener to add to the list.
-
removeJobManagerListener
public void removeJobManagerListener(org.jppf.job.JobManagerListener listener) Remove a listener from the list of listeners.- Parameters:
listener- the listener to remove from the list.
-
fireJobEvent
public void fireJobEvent(org.jppf.job.JobNotification event) Fire job listener event.- Specified by:
fireJobEventin interfaceorg.jppf.job.JobNotificationEmitter- Parameters:
event- the event to be fired.
-
getEmitterUuid
- Specified by:
getEmitterUuidin interfaceorg.jppf.job.JobNotificationEmitter
-
addJobTasksListener
public void addJobTasksListener(org.jppf.job.JobTasksListener listener) Add a listener to the list of dispatch listeners.- Specified by:
addJobTasksListenerin interfaceorg.jppf.job.JobTasksListenerManager- Parameters:
listener- the listener to add to the list.
-
removeJobTasksListener
public void removeJobTasksListener(org.jppf.job.JobTasksListener listener) Remove a listener from the list of dispatch listeners.- Specified by:
removeJobTasksListenerin interfaceorg.jppf.job.JobTasksListenerManager- Parameters:
listener- the listener to remove from the list.
-
jobResultsReceived
public void jobResultsReceived(org.jppf.execute.ExecutorChannel<?> channel, ServerJob job, Collection<ServerTask> tasks) Called when final tasks results have been received and are about to be sent back to the client.- Parameters:
channel- the node to which the job is dispatched.job- the job for which results are received.tasks- the job's tasks for which there are results.
-
loadTaskReturnListeners
public void loadTaskReturnListeners()Load all the dispatch listeners defined in the classpath with SPI. -
getNotifCount
public int getNotifCount()Get the count of notifications in the executor's quueue.- Returns:
- the ocunt as an int.
-
getNotifMax
public int getNotifMax()Peak count of notifications in the executor's quueue.- Returns:
- the ocunt as an int.
-
isBroadcastDispatch
Determine whether the specified job is the dispatch of a broadcast job to a node.- Parameters:
job- the job to evaluate.- Returns:
trueif the job is the dispatch of a broadcast job,falseotherwise.
-