hudson.plugins.buildblocker
Class BuildBlockerQueueTaskDispatcher

java.lang.Object
  extended by hudson.model.queue.QueueTaskDispatcher
      extended by hudson.plugins.buildblocker.BuildBlockerQueueTaskDispatcher
All Implemented Interfaces:
hudson.ExtensionPoint

@Extension
public class BuildBlockerQueueTaskDispatcher
extends hudson.model.queue.QueueTaskDispatcher

Queue task dispatcher that evaluates the given blocking jobs in the config of the actual job. If a blocking job is detected, the actual job will stay in the build queue.


Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
BuildBlockerQueueTaskDispatcher()
           
 
Method Summary
 hudson.model.queue.CauseOfBlockage canRun(hudson.model.Queue.Item item)
          Called whenever Queue is considering if Queue.Item is ready to execute immediately (which doesn't necessarily mean that it gets executed right away — it's still subject to executor availability), or if it should be considered blocked.
 
Methods inherited from class hudson.model.queue.QueueTaskDispatcher
all, canTake, canTake
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildBlockerQueueTaskDispatcher

public BuildBlockerQueueTaskDispatcher()
Method Detail

canRun

public hudson.model.queue.CauseOfBlockage canRun(hudson.model.Queue.Item item)
Called whenever Queue is considering if Queue.Item is ready to execute immediately (which doesn't necessarily mean that it gets executed right away — it's still subject to executor availability), or if it should be considered blocked.

Compared to QueueTaskDispatcher.canTake(hudson.model.Node, hudson.model.Queue.BuildableItem), this version tells Jenkins that the task is simply not ready to execute, even if there's available executor. This is more efficient than QueueTaskDispatcher.canTake(hudson.model.Node, hudson.model.Queue.BuildableItem), and it sends the right signal to Jenkins so that it won't use Cloud to try to provision new executors.

Vetos are additive. When multiple QueueTaskDispatchers are in the system, the task is considered blocked if any one of them returns a non-null value. (This relationship is also the same with built-in check logic.)

If a QueueTaskDispatcher returns non-null from this method, the task is placed into the 'blocked' state, and generally speaking it stays in this state for a few seconds before its state gets re-evaluated. If a QueueTaskDispatcher wants the blockage condition to be re-evaluated earlier, call Queue.scheduleMaintenance() to initiate that process.

Overrides:
canRun in class hudson.model.queue.QueueTaskDispatcher
Returns:
null to indicate that the item is ready to proceed to the buildable state as far as this QueueTaskDispatcher is concerned. Otherwise return an object that indicates why the build is blocked.
Since:
1.427


Copyright © 2004-2012. All Rights Reserved.