hudson.model.queue
Class QueueTaskFilter

java.lang.Object
  extended by hudson.model.queue.QueueTaskFilter
All Implemented Interfaces:
ModelObject, SubTask, Queue.Task, ResourceActivity

public abstract class QueueTaskFilter
extends Object
implements Queue.Task

Base class for defining filter Queue.Task.

Since:
1.360
Author:
Kohsuke Kawaguchi

Constructor Summary
protected QueueTaskFilter(Queue.Task base)
           
 
Method Summary
 void checkAbortPermission()
          Checks the permission to see if the current user can abort this executable.
 Queue.Executable createExecutable()
          Creates Queue.Executable, which performs the actual execution of the task.
 Label getAssignedLabel()
          If this task needs to be run on a node with a particular label, return that Label.
 CauseOfBlockage getCauseOfBlockage()
          If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.
 String getDisplayName()
          Used for rendering HTML.
 long getEstimatedDuration()
          Estimate of how long will it take to execute this task.
 String getFullDisplayName()
           
 Node getLastBuiltOn()
          If the previous execution of this task run on a certain node and this task prefers to run on the same node, return that.
 String getName()
          Unique name of this task.
 Queue.Task getOwnerTask()
          Gets the Queue.Task that this subtask belongs to.
 ResourceList getResourceList()
          Gets the list of Resources that this task requires.
 Object getSameNodeConstraint()
          If a subset of SubTasks of a Queue.Task needs to be collocated with other SubTasks, those SubTasks should return the equal object here.
 Collection<? extends SubTask> getSubTasks()
          Obtains the SubTasks that constitute this task.
 String getUrl()
          Returns the URL of this task relative to the context root of the application.
 String getWhyBlocked()
           
 boolean hasAbortPermission()
          Works just like Queue.Task.checkAbortPermission() except it indicates the status by a return value, instead of exception.
 boolean isBuildBlocked()
          Returns true if the execution should be blocked for temporary reasons.
 boolean isConcurrentBuild()
          True if the task allows concurrent builds, where the same Queue.TransientTask is executed by multiple executors concurrently on the same or different nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueTaskFilter

protected QueueTaskFilter(Queue.Task base)
Method Detail

getAssignedLabel

public Label getAssignedLabel()
Description copied from interface: SubTask
If this task needs to be run on a node with a particular label, return that Label. Otherwise null, indicating it can run on anywhere.

Specified by:
getAssignedLabel in interface SubTask

getLastBuiltOn

public Node getLastBuiltOn()
Description copied from interface: SubTask
If the previous execution of this task run on a certain node and this task prefers to run on the same node, return that. Otherwise null.

Specified by:
getLastBuiltOn in interface SubTask

isBuildBlocked

public boolean isBuildBlocked()
Description copied from interface: Queue.Task
Returns true if the execution should be blocked for temporary reasons.

Short-hand for getCauseOfBlockage()!=null.

Specified by:
isBuildBlocked in interface Queue.Task

getWhyBlocked

public String getWhyBlocked()
Specified by:
getWhyBlocked in interface Queue.Task

getCauseOfBlockage

public CauseOfBlockage getCauseOfBlockage()
Description copied from interface: Queue.Task
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.

Otherwise this method returns null, indicating that the build can proceed right away.

This can be used to define mutual exclusion that goes beyond ResourceActivity.getResourceList().

Specified by:
getCauseOfBlockage in interface Queue.Task

getName

public String getName()
Description copied from interface: Queue.Task
Unique name of this task.

This method is no longer used, left here for compatibility. Just return ModelObject.getDisplayName().

Specified by:
getName in interface Queue.Task

getFullDisplayName

public String getFullDisplayName()
Specified by:
getFullDisplayName in interface Queue.Task
See Also:
Item.getFullDisplayName()

getEstimatedDuration

public long getEstimatedDuration()
Description copied from interface: SubTask
Estimate of how long will it take to execute this task. Measured in milliseconds.

Specified by:
getEstimatedDuration in interface SubTask
Returns:
-1 if it's impossible to estimate.

createExecutable

public Queue.Executable createExecutable()
                                  throws IOException
Description copied from interface: SubTask
Creates Queue.Executable, which performs the actual execution of the task.

Specified by:
createExecutable in interface SubTask
Throws:
IOException

checkAbortPermission

public void checkAbortPermission()
Description copied from interface: Queue.Task
Checks the permission to see if the current user can abort this executable. Returns normally from this method if it's OK.

Specified by:
checkAbortPermission in interface Queue.Task

hasAbortPermission

public boolean hasAbortPermission()
Description copied from interface: Queue.Task
Works just like Queue.Task.checkAbortPermission() except it indicates the status by a return value, instead of exception.

Specified by:
hasAbortPermission in interface Queue.Task

getUrl

public String getUrl()
Description copied from interface: Queue.Task
Returns the URL of this task relative to the context root of the application.

When the user clicks an item in the queue, this is the page where the user is taken to. Hudson expects the current instance to be bound to the URL returned by this method.

Specified by:
getUrl in interface Queue.Task
Returns:
URL that ends with '/'.

isConcurrentBuild

public boolean isConcurrentBuild()
Description copied from interface: Queue.Task
True if the task allows concurrent builds, where the same Queue.TransientTask is executed by multiple executors concurrently on the same or different nodes.

Specified by:
isConcurrentBuild in interface Queue.Task

getDisplayName

public String getDisplayName()
Description copied from interface: ResourceActivity
Used for rendering HTML.

Specified by:
getDisplayName in interface ModelObject
Specified by:
getDisplayName in interface ResourceActivity

getResourceList

public ResourceList getResourceList()
Description copied from interface: ResourceActivity
Gets the list of Resources that this task requires. Used to make sure no two conflicting tasks run concurrently.

This method must always return the ResourceList that contains the exact same set of Resources.

If the activity doesn't lock any resources, just return new ResourceList().

Specified by:
getResourceList in interface ResourceActivity
Returns:
never null

getSubTasks

public Collection<? extends SubTask> getSubTasks()
Description copied from interface: Queue.Task
Obtains the SubTasks that constitute this task.

The collection returned by this method must also contain the primary SubTask represented by this Queue.TransientTask object itself as the first element. The returned value is read-only.

At least size 1.

Since this is a newly added method, the invocation may results in AbstractMethodError. Use Tasks#getSubTasksOf(Task) that avoids this.

Specified by:
getSubTasks in interface Queue.Task

getOwnerTask

public final Queue.Task getOwnerTask()
Description copied from interface: SubTask
Gets the Queue.Task that this subtask belongs to.

Specified by:
getOwnerTask in interface SubTask

getSameNodeConstraint

public Object getSameNodeConstraint()
Description copied from interface: SubTask
If a subset of SubTasks of a Queue.Task needs to be collocated with other SubTasks, those SubTasks should return the equal object here. If null, the execution unit isn't under a colocation constraint.

Specified by:
getSameNodeConstraint in interface SubTask


Copyright © 2004-2013. All Rights Reserved.