org.jppf.server.job
Class JPPFJobManager

java.lang.Object
  extended by org.jppf.server.job.JPPFJobManager
All Implemented Interfaces:
EventListener, QueueListener

public class JPPFJobManager
extends Object
implements QueueListener

Instances of this class manage and monitor the jobs throughout their processing within the JPPF driver.

Author:
Laurent Cohen

Field Summary
protected  List<JobListener> eventListeners
          The list of registered listeners.
 
Constructor Summary
JPPFJobManager()
          Default constructor.
 
Method Summary
 void addJobListener(JobListener listener)
          Add a listener to the list of listeners.
 void close()
          Close this job manager and release its resources.
 Set<String> getAllJobIds()
          Get the set of ids for all the jobs currently queued or executing.
 BundleWrapper getBundleForJob(String jobUuid)
          Get the queued bundle wrapper for the specified job.
 List<JobListener> getJobListeners()
          return a list of all the registered listee ners.
 List<ChannelBundlePair> getNodesForJob(String jobUuid)
          Get all the nodes to which a all or part of a job is dispatched.
 void jobDispatched(BundleWrapper bundleWrapper, ChannelWrapper channel)
          Called when all or part of a job is dispatched to a node.
 void jobEnded(BundleWrapper bundleWrapper)
          Called when a job is complete and returned to the client.
 void jobQueued(BundleWrapper bundleWrapper)
          Called when a job is added to the server queue.
 void jobReturned(BundleWrapper bundleWrapper, ChannelWrapper channel)
          Called when all or part of a job has returned from a node.
 void jobUpdated(BundleWrapper bundleWrapper)
          Called when a job is added to the server queue.
 void newBundle(QueueEvent event)
          Called when a queue event occurrs.
 void removeJobListener(JobListener listener)
          Remove a listener from the list of listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventListeners

protected List<JobListener> eventListeners
The list of registered listeners.

Constructor Detail

JPPFJobManager

public JPPFJobManager()
Default constructor.

Method Detail

getNodesForJob

public List<ChannelBundlePair> getNodesForJob(String jobUuid)
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 SelectableChannel instances.

getAllJobIds

public Set<String> getAllJobIds()
Get the set of ids for all the jobs currently queued or executing.

Returns:
a set of ids as strings.

getBundleForJob

public BundleWrapper getBundleForJob(String jobUuid)
Get the queued bundle wrapper for the specified job.

Parameters:
jobUuid - the id of the job to look for.
Returns:
a BundleWrapper instance, or null if the job is not queued anymore.

jobDispatched

public void jobDispatched(BundleWrapper bundleWrapper,
                          ChannelWrapper channel)
Called when all or part of a job is dispatched to a node.

Parameters:
bundleWrapper - the dispatched job.
channel - the node to which the job is dispatched.

jobReturned

public void jobReturned(BundleWrapper bundleWrapper,
                        ChannelWrapper channel)
Called when all or part of a job has returned from a node.

Parameters:
bundleWrapper - the returned job.
channel - the node to which the job is dispatched.

jobQueued

public void jobQueued(BundleWrapper bundleWrapper)
Called when a job is added to the server queue.

Parameters:
bundleWrapper - the queued job.

jobEnded

public void jobEnded(BundleWrapper bundleWrapper)
Called when a job is complete and returned to the client.

Parameters:
bundleWrapper - the completed job.

jobUpdated

public void jobUpdated(BundleWrapper bundleWrapper)
Called when a job is added to the server queue.

Parameters:
bundleWrapper - the queued job.

newBundle

public void newBundle(QueueEvent event)
Called when a queue event occurrs.

Specified by:
newBundle in interface QueueListener
Parameters:
event - a queue event.
See Also:
QueueListener.newBundle(org.jppf.server.queue.QueueEvent)

close

public void close()
Close this job manager and release its resources.


addJobListener

public void addJobListener(JobListener listener)
Add a listener to the list of listeners.

Parameters:
listener - the listener to add to the list.

removeJobListener

public void removeJobListener(JobListener listener)
Remove a listener from the list of listeners.

Parameters:
listener - the listener to rmeove from the list.

getJobListeners

public List<JobListener> getJobListeners()
return a list of all the registered listee ners. This list is not thread safe and must bmanually synchronized against concurrent modifications.

Returns:
a list of listener instances.


Copyright © 2005-2010 JPPF Team.