Class JPPFPriorityQueue

java.lang.Object
org.jppf.queue.AbstractJPPFQueue<ClientJob,ClientJob,ClientTaskBundle>
org.jppf.client.balancer.queue.JPPFPriorityQueue
All Implemented Interfaces:
Iterable<ClientJob>, org.jppf.queue.JPPFQueue<ClientJob,ClientJob,ClientTaskBundle>

public class JPPFPriorityQueue extends org.jppf.queue.AbstractJPPFQueue<ClientJob,ClientJob,ClientTaskBundle>
A JPPF queue whose elements are ordered by decreasing priority.
Author:
Laurent Cohen, Martin JANDA
  • Constructor Details

    • JPPFPriorityQueue

      public JPPFPriorityQueue(JobManagerClient jobManager)
      Initialize this queue.
      Parameters:
      jobManager - reference to job manager.
  • Method Details

    • addBundle

      public ClientJob addBundle(ClientJob clientJob)
      Add an object to the queue, and notify all listeners about it.
      Parameters:
      clientJob - the object to add to the queue.
    • requeue

      protected void requeue(ClientJob job)
      Handle requeue of the specified job.
      Parameters:
      job - the job to requeue.
    • nextBundle

      public ClientTaskBundle nextBundle(ClientJob job, int nbTasks, org.jppf.execute.ExecutorChannel<ClientTaskBundle> channel)
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.jppf.queue.JPPFQueue<ClientJob,ClientJob,ClientTaskBundle>
      Overrides:
      isEmpty in class org.jppf.queue.AbstractJPPFQueue<ClientJob,ClientJob,ClientTaskBundle>
    • getSize

      protected int getSize(ClientJob job)
      Get the bundle size to use for bundle size tuning.
      Specified by:
      getSize in class org.jppf.queue.AbstractJPPFQueue<ClientJob,ClientJob,ClientTaskBundle>
      Parameters:
      job - the bundle to get the size from.
      Returns:
      the bundle size as an int.
    • removeBundle

      public ClientJob removeBundle(ClientJob job)
    • updatePriority

      public void updatePriority(String jobUuid, int newPriority)
      Update the priority of the job with the specified uuid.
      Parameters:
      jobUuid - the uuid of the job to re-prioritize.
      newPriority - the new priority of the job.
    • cancelJob

      public boolean cancelJob(String jobId)
      Cancel the job with the specified UUID.
      Parameters:
      jobId - the uuid of the job to cancel.
      Returns:
      whether cancellation was successful.
    • close

      public void close()
      Close this queue and all resources it uses.
    • cancelBroadcastJobs

      public void cancelBroadcastJobs(String connectionUUID)
      Cancels queued broadcast jobs for connection.
      Parameters:
      connectionUUID - The connection UUID that failed or was disconnected.
    • processPendingBroadcasts

      public void processPendingBroadcasts()
      Process the jobs in the pending broadcast queue. This method is normally called from TaskQueueChecker.dispatch().
    • getJPPFJobs

      public List<JPPFJob> getJPPFJobs()
      Get all the JPPFJobs currently in the queue.

      This method should be used with caution, as its cost is in O(n), with n being the number of jobs in the queue.

      Returns:
      a list of JPPFJob instances ordered by their priority.
      Since:
      4.1