Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
298e3713
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
298e3713
编写于
5月 18, 2015
作者:
O
Oleg Nenashev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Code documentation/annotation around JENKINS-28446.
Just to prevent similar misuses in the future.
上级
8373984f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
7 deletion
+14
-7
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Queue.java
+12
-6
core/src/main/java/hudson/model/labels/LabelAssignmentAction.java
.../main/java/hudson/model/labels/LabelAssignmentAction.java
+2
-1
未找到文件。
core/src/main/java/hudson/model/Queue.java
浏览文件 @
298e3713
...
...
@@ -124,6 +124,7 @@ import org.kohsuke.accmod.restrictions.DoNotUse;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
;
import
javax.annotation.CheckForNull
;
import
javax.annotation.Nonnegative
;
import
jenkins.model.queue.AsynchronousExecution
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
...
...
@@ -942,8 +943,10 @@ public class Queue extends ResourceController implements Saveable {
/**
* How many {@link BuildableItem}s are assigned for the given label?
* @param l Label to be checked. If null, any label will be accepted
* @return Number of {@link BuildableItem}s for the specified label.
*/
public
int
countBuildableItemsFor
(
Label
l
)
{
public
@Nonnegative
int
countBuildableItemsFor
(
@CheckForNull
Label
l
)
{
Snapshot
snapshot
=
this
.
snapshot
;
int
r
=
0
;
for
(
BuildableItem
bi
:
snapshot
.
buildables
)
...
...
@@ -1808,13 +1811,16 @@ public class Queue extends ResourceController implements Saveable {
}
/**
* Test if the specified {@link SubTask} needs to be run on a node with a particular label, and
* return that {@link Label}. Otherwise null, indicating it can run on anywhere.
*
* Test if the specified {@link SubTask} needs to be run on a node with a particular label.
* <p>
* This code takes {@link LabelAssignmentAction} into account, then falls back to {@link SubTask#getAssignedLabel()}
* This method takes {@link LabelAssignmentAction} into account, the first
* non-null assignment will be returned.
* Otherwise falls back to {@link SubTask#getAssignedLabel()}
* @param st {@link SubTask} to be checked.
* @return Required {@link Label}. Otherwise null, indicating it can run on anywhere.
*/
public
Label
getAssignedLabelFor
(
SubTask
st
)
{
public
@CheckForNull
Label
getAssignedLabelFor
(
@Nonnull
SubTask
st
)
{
for
(
LabelAssignmentAction
laa
:
getActions
(
LabelAssignmentAction
.
class
))
{
Label
l
=
laa
.
getAssignedLabel
(
st
);
if
(
l
!=
null
)
return
l
;
...
...
core/src/main/java/hudson/model/labels/LabelAssignmentAction.java
浏览文件 @
298e3713
...
...
@@ -7,6 +7,7 @@ import hudson.model.Queue;
import
hudson.model.Queue.QueueDecisionHandler
;
import
hudson.model.Queue.Task
;
import
hudson.model.queue.SubTask
;
import
javax.annotation.Nonnull
;
/**
* {@link Action} that can be submitted to {@link Queue} that controls where
...
...
@@ -35,5 +36,5 @@ public interface LabelAssignmentAction extends Action {
* null to let other {@link LabelAssignmentAction}s take control, eventually to {@code SubTask#getAssignedLabel()}.
* If non-null value is returned, that label will be authoritative.
*/
Label
getAssignedLabel
(
SubTask
task
);
Label
getAssignedLabel
(
@Nonnull
SubTask
task
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录