org.jppf.server.queue
Class JPPFPriorityQueue

java.lang.Object
  extended by org.jppf.server.queue.AbstractJPPFQueue
      extended by org.jppf.server.queue.JPPFPriorityQueue
All Implemented Interfaces:
Iterable<BundleWrapper>, JPPFQueue

public class JPPFPriorityQueue
extends AbstractJPPFQueue

A JPPF queue whose elements are ordered by decreasing priority.

Author:
Laurent Cohen

Field Summary
protected  JPPFJobManager jobManager
          The job manager.
protected  JPPFDriverStatsManager statsManager
          The driver stats manager.
 
Fields inherited from class org.jppf.server.queue.AbstractJPPFQueue
latestMaxSize, lock, queueListeners, sizeMap
 
Constructor Summary
JPPFPriorityQueue()
          Initialize this queue.
 
Method Summary
 void addBundle(BundleWrapper bundleWrapper)
          Add an object to the queue, and notify all listeners about it.
 void clearSchedules(String jobUuid)
          Clear all the scheduled actions associated with a job.
 int getMaxBundleSize()
          Get the maximum bundle size for the bundles present in the queue.
 boolean isEmpty()
          Determine whether the queue is empty or not.
 Iterator<BundleWrapper> iterator()
          Get an iterator on the task bundles in this queue.
 BundleWrapper nextBundle(BundleWrapper bundleWrapper, int nbTasks)
          Get the next object in the queue.
 BundleWrapper nextBundle(int nbTasks)
          Get the next object in the queue.
 BundleWrapper removeBundle(BundleWrapper bundleWrapper)
          Remove the specified bundle from the queue.
 
Methods inherited from class org.jppf.server.queue.AbstractJPPFQueue
addQueueListener, fireQueueEvent, getLock, getQueueListeners, getSize, removeQueueListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statsManager

protected JPPFDriverStatsManager statsManager
The driver stats manager.


jobManager

protected JPPFJobManager jobManager
The job manager.

Constructor Detail

JPPFPriorityQueue

public JPPFPriorityQueue()
Initialize this queue.

Method Detail

addBundle

public void addBundle(BundleWrapper bundleWrapper)
Add an object to the queue, and notify all listeners about it.

Parameters:
bundleWrapper - the object to add to the queue.
See Also:
JPPFQueue.addBundle(org.jppf.server.protocol.BundleWrapper)

nextBundle

public BundleWrapper nextBundle(int nbTasks)
Get the next object in the queue.

Parameters:
nbTasks - the maximum number of tasks to get out of the bundle.
Returns:
the most recent object that was added to the queue.
See Also:
JPPFQueue.nextBundle(int)

nextBundle

public BundleWrapper nextBundle(BundleWrapper bundleWrapper,
                                int nbTasks)
Get the next object in the queue.

Parameters:
bundleWrapper - the bundle to either remove or extract a sub-bundle from.
nbTasks - the maximum number of tasks to get out of the bundle.
Returns:
the most recent object that was added to the queue.
See Also:
JPPFQueue.nextBundle(org.jppf.server.protocol.BundleWrapper, int)

isEmpty

public boolean isEmpty()
Determine whether the queue is empty or not.

Returns:
true if the queue is empty, false otherwise.
See Also:
JPPFQueue.isEmpty()

getMaxBundleSize

public int getMaxBundleSize()
Get the maximum bundle size for the bundles present in the queue.

Returns:
the bundle size as an int.
See Also:
JPPFQueue.getMaxBundleSize()

removeBundle

public BundleWrapper removeBundle(BundleWrapper bundleWrapper)
Remove the specified bundle from the queue.

Parameters:
bundleWrapper - the bundle to remove.
Returns:
the bundle that was removed.

iterator

public Iterator<BundleWrapper> iterator()
Get an iterator on the task bundles in this queue.

Returns:
an iterator.
See Also:
Iterable.iterator()

clearSchedules

public void clearSchedules(String jobUuid)
Clear all the scheduled actions associated with a job. This method should normally only be called when a job has completed.

Parameters:
jobUuid - the job uuid.


Copyright © 2005-2010 JPPF Team.