Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
cdc39802
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,发现更多精彩内容 >>
提交
cdc39802
编写于
3月 28, 2014
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create a ViewJob.ReloadThread only if and when someone has a ViewJob to be reloaded.
上级
ad5cd804
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
30 addition
and
18 deletion
+30
-18
core/src/main/java/hudson/model/AbstractCIBase.java
core/src/main/java/hudson/model/AbstractCIBase.java
+1
-1
core/src/main/java/hudson/model/ViewJob.java
core/src/main/java/hudson/model/ViewJob.java
+29
-17
未找到文件。
core/src/main/java/hudson/model/AbstractCIBase.java
浏览文件 @
cdc39802
...
@@ -81,7 +81,7 @@ public abstract class AbstractCIBase extends Node implements ItemGroup<TopLevelI
...
@@ -81,7 +81,7 @@ public abstract class AbstractCIBase extends Node implements ItemGroup<TopLevelI
v
.
owner
=
this
;
v
.
owner
=
this
;
}
}
protected
void
interruptReloadThread
()
{
protected
void
interruptReloadThread
()
{
ViewJob
.
reloadThread
.
interrupt
();
ViewJob
.
interruptReloadThread
();
}
}
protected
void
killComputer
(
Computer
c
)
{
protected
void
killComputer
(
Computer
c
)
{
...
...
core/src/main/java/hudson/model/ViewJob.java
浏览文件 @
cdc39802
...
@@ -23,18 +23,17 @@
...
@@ -23,18 +23,17 @@
*/
*/
package
hudson.model
;
package
hudson.model
;
import
jenkins.model.Jenkins
;
import
hudson.model.Descriptor.FormException
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
import
javax.servlet.ServletException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
java.util.SortedMap
;
import
java.util.SortedMap
;
import
hudson.model.Descriptor.FormException
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
javax.servlet.ServletException
;
import
jenkins.model.Jenkins
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
/**
/**
* {@link Job} that monitors activities that happen outside Hudson,
* {@link Job} that monitors activities that happen outside Hudson,
...
@@ -69,16 +68,12 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
...
@@ -69,16 +68,12 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
*/
*/
private
transient
volatile
boolean
reloadingInProgress
;
private
transient
volatile
boolean
reloadingInProgress
;
/**
private
static
ReloadThread
reloadThread
;
* {@link ExternalJob}s that need to be reloaded.
*
static
synchronized
void
interruptReloadThread
()
{
* This is a set, so no {@link ExternalJob}s are scheduled twice, yet
if
(
reloadThread
!=
null
)
{
* it's order is predictable, avoiding starvation.
reloadThread
.
interrupt
();
*/
}
private
static
final
LinkedHashSet
<
ViewJob
>
reloadQueue
=
new
LinkedHashSet
<
ViewJob
>();
/*package*/
static
final
Thread
reloadThread
=
new
ReloadThread
();
static
{
reloadThread
.
start
();
}
}
/**
/**
...
@@ -120,6 +115,14 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
...
@@ -120,6 +115,14 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
// we don't want to block the current thread,
// we don't want to block the current thread,
// so reloading is done asynchronously.
// so reloading is done asynchronously.
reloadingInProgress
=
true
;
reloadingInProgress
=
true
;
Set
<
ViewJob
>
reloadQueue
;
synchronized
(
ViewJob
.
class
)
{
if
(
reloadThread
==
null
)
{
reloadThread
=
new
ReloadThread
();
reloadThread
.
start
();
}
reloadQueue
=
reloadThread
.
reloadQueue
;
}
synchronized
(
reloadQueue
)
{
synchronized
(
reloadQueue
)
{
reloadQueue
.
add
(
this
);
reloadQueue
.
add
(
this
);
reloadQueue
.
notify
();
reloadQueue
.
notify
();
...
@@ -164,6 +167,15 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
...
@@ -164,6 +167,15 @@ public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>, RunT extends Run<
* Thread that reloads the {@link Run}s.
* Thread that reloads the {@link Run}s.
*/
*/
private
static
final
class
ReloadThread
extends
Thread
{
private
static
final
class
ReloadThread
extends
Thread
{
/**
* {@link ExternalJob}s that need to be reloaded.
*
* This is a set, so no {@link ExternalJob}s are scheduled twice, yet
* it's order is predictable, avoiding starvation.
*/
final
Set
<
ViewJob
>
reloadQueue
=
new
LinkedHashSet
<
ViewJob
>();
private
ReloadThread
()
{
private
ReloadThread
()
{
setName
(
"ViewJob reload thread"
);
setName
(
"ViewJob reload thread"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录