Class JobScheduler

java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.client.balancer.queue.JobScheduler
All Implemented Interfaces:
Runnable

public class JobScheduler extends org.jppf.utils.concurrent.ThreadSynchronization implements Runnable
This class ensures that idle nodes get assigned pending tasks from the job queue.
  • Constructor Details

    • JobScheduler

      public JobScheduler(JPPFPriorityQueue queue, org.jppf.load.balancer.spi.JPPFBundlerFactory bundlerFactory)
      Initialize this task queue checker with the specified queue.
      Parameters:
      queue - the job queue to use.
      bundlerFactory - the load-balancer factory.
  • Method Details

    • getJPPFContext

      public org.jppf.load.balancer.JPPFContext getJPPFContext()
      Get the corresponding node's context information.
      Returns:
      a JPPFContext instance.
    • setHighestPriority

      public void setHighestPriority(int priority)
      Set the highest priority.
      Parameters:
      priority - the new highest priority.
    • getHighestPriority

      public int getHighestPriority()
      Set the highest priority.
      Returns:
      the highest priority.
    • getNbIdleChannels

      public int getNbIdleChannels()
      Get the number of idle channels.
      Returns:
      the size of the underlying list of idle channels.
    • addIdleChannel

      public void addIdleChannel(ChannelWrapper channel)
      Add a channel to the list of idle channels.
      Parameters:
      channel - the channel to add to the list.
    • removeIdleChannel

      public void removeIdleChannel(ChannelWrapper channel)
      Remove a channel from the list of idle channels.
      Parameters:
      channel - the channel to remove from the list.
    • getIdleChannels

      public List<ChannelWrapper> getIdleChannels()
      Get the list of idle channels.
      Returns:
      a new copy of the underlying list of idle channels.
    • hasIdleChannel

      public boolean hasIdleChannel()
      Return whether any idle channel is available.
      Returns:
      true when there are no idle channels.
    • clearChannels

      public void clearChannels()
      Clear all channels from this task queue checker.
    • run

      public void run()
      Perform the assignment of tasks.
      Specified by:
      run in interface Runnable
    • dispatch

      public boolean dispatch()
      Perform the assignment of tasks.
      Returns:
      true if a job was dispatched, false otherwise.