mirror of https://github.com/jenkinsci/jenkins.git
Add annotations as documented (#6325)
This commit is contained in:
parent
66cd7821d3
commit
99ae887070
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package hudson.model;
|
package hudson.model;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||||
import hudson.Extension;
|
import hudson.Extension;
|
||||||
import hudson.ExtensionList;
|
import hudson.ExtensionList;
|
||||||
import hudson.ExtensionPoint;
|
import hudson.ExtensionPoint;
|
||||||
|
|
@ -57,5 +58,5 @@ public abstract class LabelFinder implements ExtensionPoint {
|
||||||
* @return
|
* @return
|
||||||
* A set of labels for the node. Can be empty but never null.
|
* A set of labels for the node. Can be empty but never null.
|
||||||
*/
|
*/
|
||||||
public abstract Collection<LabelAtom> findLabels(Node node);
|
public abstract @NonNull Collection<LabelAtom> findLabels(@NonNull Node node);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
package hudson.model;
|
package hudson.model;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||||
|
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||||
import hudson.Extension;
|
import hudson.Extension;
|
||||||
import hudson.ExtensionPoint;
|
import hudson.ExtensionPoint;
|
||||||
import hudson.model.Queue.Task;
|
import hudson.model.Queue.Task;
|
||||||
|
|
@ -71,14 +73,16 @@ public abstract class LoadBalancer implements ExtensionPoint {
|
||||||
* Return null if you don't want the task to be executed right now,
|
* Return null if you don't want the task to be executed right now,
|
||||||
* in which case this method will be called some time later with the same task.
|
* in which case this method will be called some time later with the same task.
|
||||||
*/
|
*/
|
||||||
public abstract Mapping map(Task task, MappingWorksheet worksheet);
|
@CheckForNull
|
||||||
|
public abstract Mapping map(@NonNull Task task, MappingWorksheet worksheet);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses a consistent hash for scheduling.
|
* Uses a consistent hash for scheduling.
|
||||||
*/
|
*/
|
||||||
public static final LoadBalancer CONSISTENT_HASH = new LoadBalancer() {
|
public static final LoadBalancer CONSISTENT_HASH = new LoadBalancer() {
|
||||||
|
@CheckForNull
|
||||||
@Override
|
@Override
|
||||||
public Mapping map(Task task, MappingWorksheet ws) {
|
public Mapping map(@NonNull Task task, MappingWorksheet ws) {
|
||||||
// build consistent hash for each work chunk
|
// build consistent hash for each work chunk
|
||||||
List<ConsistentHash<ExecutorChunk>> hashes = new ArrayList<>(ws.works.size());
|
List<ConsistentHash<ExecutorChunk>> hashes = new ArrayList<>(ws.works.size());
|
||||||
for (int i = 0; i < ws.works.size(); i++) {
|
for (int i = 0; i < ws.works.size(); i++) {
|
||||||
|
|
@ -152,8 +156,9 @@ public abstract class LoadBalancer implements ExtensionPoint {
|
||||||
protected LoadBalancer sanitize() {
|
protected LoadBalancer sanitize() {
|
||||||
final LoadBalancer base = this;
|
final LoadBalancer base = this;
|
||||||
return new LoadBalancer() {
|
return new LoadBalancer() {
|
||||||
|
@CheckForNull
|
||||||
@Override
|
@Override
|
||||||
public Mapping map(Task task, MappingWorksheet worksheet) {
|
public Mapping map(@NonNull Task task, MappingWorksheet worksheet) {
|
||||||
if (Queue.isBlockedByShutdown(task)) {
|
if (Queue.isBlockedByShutdown(task)) {
|
||||||
// if we are quieting down, don't start anything new so that
|
// if we are quieting down, don't start anything new so that
|
||||||
// all executors will be eventually free.
|
// all executors will be eventually free.
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ import static org.junit.Assert.fail;
|
||||||
import com.gargoylesoftware.htmlunit.HttpMethod;
|
import com.gargoylesoftware.htmlunit.HttpMethod;
|
||||||
import com.gargoylesoftware.htmlunit.Page;
|
import com.gargoylesoftware.htmlunit.Page;
|
||||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||||
|
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||||
import hudson.EnvVars;
|
import hudson.EnvVars;
|
||||||
import hudson.FilePath;
|
import hudson.FilePath;
|
||||||
import hudson.model.Node.Mode;
|
import hudson.model.Node.Mode;
|
||||||
|
|
@ -429,8 +430,9 @@ public class NodeTest {
|
||||||
@TestExtension
|
@TestExtension
|
||||||
public static class LabelFinderImpl extends LabelFinder {
|
public static class LabelFinderImpl extends LabelFinder {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<LabelAtom> findLabels(Node node) {
|
public Collection<LabelAtom> findLabels(@NonNull Node node) {
|
||||||
List<LabelAtom> atoms = new ArrayList<>();
|
List<LabelAtom> atoms = new ArrayList<>();
|
||||||
if (addDynamicLabel) {
|
if (addDynamicLabel) {
|
||||||
atoms.add(Jenkins.get().getLabelAtom("dynamicLabel"));
|
atoms.add(Jenkins.get().getLabelAtom("dynamicLabel"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue