Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5e864098
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5e864098
编写于
6月 23, 2008
作者:
I
idk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6623943: javax.swing.TimerQueue's thread occasionally fails to start
Reviewed-by: alexp
上级
82f96368
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
37 deletion
+35
-37
src/share/classes/javax/swing/JApplet.java
src/share/classes/javax/swing/JApplet.java
+1
-4
src/share/classes/javax/swing/TimerQueue.java
src/share/classes/javax/swing/TimerQueue.java
+34
-33
未找到文件。
src/share/classes/javax/swing/JApplet.java
浏览文件 @
5e864098
...
...
@@ -131,10 +131,7 @@ public class JApplet extends Applet implements Accessible,
// Check the timerQ and restart if necessary.
TimerQueue
q
=
TimerQueue
.
sharedInstance
();
if
(
q
!=
null
)
{
synchronized
(
q
)
{
if
(!
q
.
running
)
q
.
start
();
}
q
.
startIfNeeded
();
}
/* Workaround for bug 4155072. The shared double buffer image
...
...
src/share/classes/javax/swing/TimerQueue.java
浏览文件 @
5e864098
...
...
@@ -31,6 +31,7 @@ package javax.swing;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.concurrent.locks.*
;
import
java.util.concurrent.atomic.AtomicLong
;
import
sun.awt.AppContext
;
...
...
@@ -52,7 +53,8 @@ class TimerQueue implements Runnable
new
StringBuffer
(
"TimerQueue.expiredTimersKey"
);
private
final
DelayQueue
<
DelayedTimer
>
queue
;
volatile
boolean
running
;
private
volatile
boolean
running
;
private
final
Lock
runningLock
;
/* Lock object used in place of class object for synchronization.
* (4187686)
...
...
@@ -69,7 +71,8 @@ class TimerQueue implements Runnable
super
();
queue
=
new
DelayQueue
<
DelayedTimer
>();
// Now start the TimerQueue thread.
start
();
runningLock
=
new
ReentrantLock
();
startIfNeeded
();
}
...
...
@@ -87,33 +90,30 @@ class TimerQueue implements Runnable
}
synchronized
void
start
()
{
if
(
running
)
{
throw
new
RuntimeException
(
"Can't start a TimerQueue "
+
"that is already running"
);
}
else
{
final
ThreadGroup
threadGroup
=
AppContext
.
getAppContext
().
getThreadGroup
();
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
()
{
public
Object
run
()
{
Thread
timerThread
=
new
Thread
(
threadGroup
,
TimerQueue
.
this
,
"TimerQueue"
);
timerThread
.
setDaemon
(
true
);
timerThread
.
setPriority
(
Thread
.
NORM_PRIORITY
);
timerThread
.
start
();
return
null
;
}
});
running
=
true
;
void
startIfNeeded
()
{
if
(!
running
)
{
runningLock
.
lock
();
try
{
final
ThreadGroup
threadGroup
=
AppContext
.
getAppContext
().
getThreadGroup
();
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
()
{
public
Object
run
()
{
Thread
timerThread
=
new
Thread
(
threadGroup
,
TimerQueue
.
this
,
"TimerQueue"
);
timerThread
.
setDaemon
(
true
);
timerThread
.
setPriority
(
Thread
.
NORM_PRIORITY
);
timerThread
.
start
();
return
null
;
}
});
running
=
true
;
}
finally
{
runningLock
.
unlock
();
}
}
}
synchronized
void
stop
()
{
running
=
false
;
}
void
addTimer
(
Timer
timer
,
long
delayMillis
)
{
timer
.
getLock
().
lock
();
try
{
...
...
@@ -164,6 +164,7 @@ class TimerQueue implements Runnable
public
void
run
()
{
runningLock
.
lock
();
try
{
while
(
running
)
{
try
{
...
...
@@ -195,14 +196,14 @@ class TimerQueue implements Runnable
}
}
catch
(
ThreadDeath
td
)
{
synchronized
(
this
)
{
running
=
false
;
// Mark all the timers we contain as not being queued.
for
(
DelayedTimer
delayedTimer
:
queue
)
{
delayedTimer
.
getTimer
().
cancelEvent
();
}
throw
td
;
// Mark all the timers we contain as not being queued.
for
(
DelayedTimer
delayedTimer
:
queue
)
{
delayedTimer
.
getTimer
().
cancelEvent
();
}
throw
td
;
}
finally
{
running
=
false
;
runningLock
.
unlock
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录