Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
Dragonwell11
提交
191306f2
D
Dragonwell11
项目概览
LinuxSuRen
/
Dragonwell11
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
191306f2
编写于
2月 10, 2018
作者:
D
dl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8190324: ThreadPoolExecutor should not specify a dependency on finalization
Reviewed-by: martin, psandoz, alanb, rriggs, dholmes
上级
82bda573
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
5 deletion
+29
-5
src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
...hare/classes/java/util/concurrent/ThreadPoolExecutor.java
+14
-5
test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
...a/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
+15
-0
未找到文件。
src/java.base/share/classes/java/util/concurrent/ThreadPoolExecutor.java
浏览文件 @
191306f2
...
...
@@ -35,9 +35,6 @@
package
java.util.concurrent
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.ArrayList
;
import
java.util.ConcurrentModificationException
;
import
java.util.HashSet
;
...
...
@@ -268,8 +265,8 @@ import java.util.concurrent.locks.ReentrantLock;
*
* <dd>A pool that is no longer referenced in a program <em>AND</em>
* has no remaining threads may be reclaimed (garbage collected)
* without being explicit
y shutdown. You can configure a pool to allow
* all unused threads to eventually die by setting appropriate
* without being explicit
ly shutdown. You can configure a pool to
* all
ow all
unused threads to eventually die by setting appropriate
* keep-alive times, using a lower bound of zero core threads and/or
* setting {@link #allowCoreThreadTimeOut(boolean)}. </dd>
*
...
...
@@ -1462,6 +1459,18 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
}
}
// Override without "throws Throwable" for compatibility with subclasses
// whose finalize method invokes super.finalize() (as is recommended).
// Before JDK 11, finalize() had a non-empty method body.
/**
* @implNote Previous versions of this class had a finalize method
* that shut down this executor, but in this version, finalize
* does nothing.
*/
@Deprecated
(
since
=
"9"
)
protected
void
finalize
()
{}
/**
* Sets the thread factory used to create new threads.
*
...
...
test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java
浏览文件 @
191306f2
...
...
@@ -1994,4 +1994,19 @@ public class ThreadPoolExecutorSubclassTest extends JSR166TestCase {
}
}
public
void
testFinalizeMethodCallsSuperFinalize
()
{
new
CustomTPE
(
1
,
1
,
LONG_DELAY_MS
,
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>())
{
/**
* A finalize method without "throws Throwable", that
* calls super.finalize().
*/
protected
void
finalize
()
{
super
.
finalize
();
}
}.
shutdown
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录