Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4356bd9a
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看板
提交
4356bd9a
编写于
2月 09, 2011
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6818960: ImageFetcher ( MediaTracker) Thread leak
Reviewed-by: igor, prr
上级
c81cfa0d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
8 deletion
+33
-8
src/share/classes/sun/awt/image/ImageFetcher.java
src/share/classes/sun/awt/image/ImageFetcher.java
+26
-6
src/share/classes/sun/awt/image/InputStreamImageSource.java
src/share/classes/sun/awt/image/InputStreamImageSource.java
+7
-2
未找到文件。
src/share/classes/sun/awt/image/ImageFetcher.java
浏览文件 @
4356bd9a
...
@@ -61,8 +61,10 @@ class ImageFetcher extends Thread {
...
@@ -61,8 +61,10 @@ class ImageFetcher extends Thread {
/**
/**
* Adds an ImageFetchable to the queue of items to fetch. Instantiates
* Adds an ImageFetchable to the queue of items to fetch. Instantiates
* a new ImageFetcher if it's reasonable to do so.
* a new ImageFetcher if it's reasonable to do so.
* If there is no available fetcher to process an ImageFetchable, then
* reports failure to caller.
*/
*/
public
static
void
add
(
ImageFetchable
src
)
{
public
static
boolean
add
(
ImageFetchable
src
)
{
final
FetcherInfo
info
=
FetcherInfo
.
getFetcherInfo
();
final
FetcherInfo
info
=
FetcherInfo
.
getFetcherInfo
();
synchronized
(
info
.
waitList
)
{
synchronized
(
info
.
waitList
)
{
if
(!
info
.
waitList
.
contains
(
src
))
{
if
(!
info
.
waitList
.
contains
(
src
))
{
...
@@ -71,9 +73,23 @@ class ImageFetcher extends Thread {
...
@@ -71,9 +73,23 @@ class ImageFetcher extends Thread {
info
.
numFetchers
<
info
.
fetchers
.
length
)
{
info
.
numFetchers
<
info
.
fetchers
.
length
)
{
createFetchers
(
info
);
createFetchers
(
info
);
}
}
info
.
waitList
.
notify
();
/* Creation of new fetcher may fail due to high vm load
* or some other reason.
* If there is already exist, but busy, fetcher, we leave
* the src in queue (it will be handled by existing
* fetcher later).
* Otherwise, we report failure: there is no fetcher
* to handle the src.
*/
if
(
info
.
numFetchers
>
0
)
{
info
.
waitList
.
notify
();
}
else
{
info
.
waitList
.
removeElement
(
src
);
return
false
;
}
}
}
}
}
return
true
;
}
}
/**
/**
...
@@ -291,11 +307,15 @@ class ImageFetcher extends Thread {
...
@@ -291,11 +307,15 @@ class ImageFetcher extends Thread {
public
Object
run
()
{
public
Object
run
()
{
for
(
int
i
=
0
;
i
<
info
.
fetchers
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
info
.
fetchers
.
length
;
i
++)
{
if
(
info
.
fetchers
[
i
]
==
null
)
{
if
(
info
.
fetchers
[
i
]
==
null
)
{
info
.
fetchers
[
i
]
=
new
ImageFetcher
(
ImageFetcher
f
=
new
ImageFetcher
(
fetcherGroup
,
i
);
fetcherGroup
,
i
);
info
.
fetchers
[
i
].
start
();
try
{
info
.
numFetchers
++;
f
.
start
();
break
;
info
.
fetchers
[
i
]
=
f
;
info
.
numFetchers
++;
break
;
}
catch
(
Error
e
)
{
}
}
}
}
}
return
null
;
return
null
;
...
...
src/share/classes/sun/awt/image/InputStreamImageSource.java
浏览文件 @
4356bd9a
...
@@ -164,8 +164,13 @@ public abstract class InputStreamImageSource implements ImageProducer,
...
@@ -164,8 +164,13 @@ public abstract class InputStreamImageSource implements ImageProducer,
private
synchronized
void
startProduction
()
{
private
synchronized
void
startProduction
()
{
if
(!
awaitingFetch
)
{
if
(!
awaitingFetch
)
{
ImageFetcher
.
add
(
this
);
if
(
ImageFetcher
.
add
(
this
))
{
awaitingFetch
=
true
;
awaitingFetch
=
true
;
}
else
{
ImageConsumerQueue
cq
=
consumers
;
consumers
=
null
;
errorAllConsumers
(
cq
,
false
);
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录