File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\model\labels\LabelAssignmentAction.java.html

1 package hudson.model.labels;
2
3 import hudson.model.Action;
4 import hudson.model.Label;
5 import hudson.model.LoadBalancer;
6 import hudson.model.Queue;
7 import hudson.model.Queue.QueueDecisionHandler;
8 import hudson.model.Queue.Task;
9 import hudson.model.queue.SubTask;
10
11 /**
12 * {@link Action} that can be submitted to {@link Queue} that controls where
13 * the task runs.
14 *
15 * <h2>Where to insert {@link LabelAssignmentAction}s</h2>
16 * <p>
17 * If you control when the task gets submitted to the queue, you can associate this action
18 * to the task by passing it as a parameter to method like {@link Queue#schedule(Task, int, Action...)}.
19 *
20 * <p>
21 * If you want to globally affect the scheduling decision, you can do so by {@link QueueDecisionHandler}
22 * and alter the list of actions that you get. Alternatively, you can implement your own {@link LoadBalancer}
23 * and bypass the whole label/assignment mechanism to control the decision into your own hands.
24 *
25 * @author Kohsuke Kawaguchi
26 * @since 1.416
27 */
28 public interface LabelAssignmentAction extends Action {
29 /**
30 * Reassigns where the task gets run.
31 *
32 * @param task
33 * Never null.
34 * @return
35 * null to let other {@link LabelAssignmentAction}s take control, eventually to {@code SubTask#getAssignedLabel()}.
36 * If non-null value is returned, that label will be authoritative.
37 */
38 Label getAssignedLabel(SubTask task);
39 }
40