提交 b35c23b8 编写于 作者: P phh

8237117: Better ForkJoinPool behavior

Reviewed-by: mbalao, andrew
上级 6ff7e27a
...@@ -73,6 +73,11 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -73,6 +73,11 @@ public class ForkJoinWorkerThread extends Thread {
final ForkJoinPool pool; // the pool this thread works in final ForkJoinPool pool; // the pool this thread works in
final ForkJoinPool.WorkQueue workQueue; // work-stealing mechanics final ForkJoinPool.WorkQueue workQueue; // work-stealing mechanics
/** An AccessControlContext supporting no privileges */
private static final AccessControlContext INNOCUOUS_ACC =
new AccessControlContext(
new ProtectionDomain[] { new ProtectionDomain(null, null) });
/** /**
* Creates a ForkJoinWorkerThread operating in the given pool. * Creates a ForkJoinWorkerThread operating in the given pool.
* *
...@@ -82,6 +87,7 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -82,6 +87,7 @@ public class ForkJoinWorkerThread extends Thread {
protected ForkJoinWorkerThread(ForkJoinPool pool) { protected ForkJoinWorkerThread(ForkJoinPool pool) {
// Use a placeholder until a useful name can be set in registerWorker // Use a placeholder until a useful name can be set in registerWorker
super("aForkJoinWorkerThread"); super("aForkJoinWorkerThread");
U.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, INNOCUOUS_ACC);
this.pool = pool; this.pool = pool;
this.workQueue = pool.registerWorker(this); this.workQueue = pool.registerWorker(this);
} }
...@@ -215,13 +221,6 @@ public class ForkJoinWorkerThread extends Thread { ...@@ -215,13 +221,6 @@ public class ForkJoinWorkerThread extends Thread {
private static final ThreadGroup innocuousThreadGroup = private static final ThreadGroup innocuousThreadGroup =
createThreadGroup(); createThreadGroup();
/** An AccessControlContext supporting no privileges */
private static final AccessControlContext INNOCUOUS_ACC =
new AccessControlContext(
new ProtectionDomain[] {
new ProtectionDomain(null, null)
});
InnocuousForkJoinWorkerThread(ForkJoinPool pool) { InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
super(pool, innocuousThreadGroup, INNOCUOUS_ACC); super(pool, innocuousThreadGroup, INNOCUOUS_ACC);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册