Package org.jppf.client.balancer.queue
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.
-
Field Summary
Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stopped -
Constructor Summary
ConstructorsConstructorDescriptionJobScheduler(JPPFPriorityQueue queue, org.jppf.load.balancer.spi.JPPFBundlerFactory bundlerFactory) Initialize this task queue checker with the specified queue. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIdleChannel(ChannelWrapper channel) Add a channel to the list of idle channels.voidClear all channels from this task queue checker.booleandispatch()Perform the assignment of tasks.intSet the highest priority.Get the list of idle channels.org.jppf.load.balancer.JPPFContextGet the corresponding node's context information.intGet the number of idle channels.booleanReturn whether any idle channel is available.voidremoveIdleChannel(ChannelWrapper channel) Remove a channel from the list of idle channels.voidrun()Perform the assignment of tasks.voidsetHighestPriority(int priority) Set the highest priority.Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
-
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
JPPFContextinstance.
-
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
Add a channel to the list of idle channels.- Parameters:
channel- the channel to add to the list.
-
removeIdleChannel
Remove a channel from the list of idle channels.- Parameters:
channel- the channel to remove from the list.
-
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. -
dispatch
public boolean dispatch()Perform the assignment of tasks.- Returns:
- true if a job was dispatched, false otherwise.
-