ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ForkJoinWorkerThread.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ForkJoinWorkerThread.java (file contents):
Revision 1.83 by dl, Fri Mar 18 16:01:42 2022 UTC vs.
Revision 1.84 by dl, Fri Apr 29 17:00:36 2022 UTC

# Line 43 | Line 43 | public class ForkJoinWorkerThread extend
43       * Full nonpublic constructor.
44       */
45      ForkJoinWorkerThread(ThreadGroup group, ForkJoinPool pool,
46 <                         boolean useSystemClassLoader) {
47 <        super(group, null, pool.nextWorkerThreadName(), 0L);
46 >                         boolean useSystemClassLoader, boolean isInnocuous) {
47 >        super(group, null, pool.nextWorkerThreadName(), 0L, !isInnocuous);
48          UncaughtExceptionHandler handler = (this.pool = pool).ueh;
49          this.workQueue = new ForkJoinPool.WorkQueue(this, 0);
50          super.setDaemon(true);
# Line 56 | Line 56 | public class ForkJoinWorkerThread extend
56  
57      /**
58       * Creates a ForkJoinWorkerThread operating in the given thread group and
59 <     * pool.
59 >     * pool, and with the given policy for preserving ThreadLocals.
60       *
61       * @param group if non-null, the thread group for this thread
62       * @param pool the pool this thread works in
63 +     * @param preserveThreadLocals if true, always preserve the values of
64 +     * ThreadLocal variables across tasks; otherwise they may be cleared.
65       * @throws NullPointerException if pool is null
66 +     * @since 19
67       */
68 <    ForkJoinWorkerThread(ThreadGroup group, ForkJoinPool pool) {
69 <        this(group, pool, false);
68 >    protected ForkJoinWorkerThread(ThreadGroup group, ForkJoinPool pool,
69 >                                   boolean preserveThreadLocals) {
70 >        this(group, pool, false, !preserveThreadLocals);
71      }
72  
73      /**
# Line 73 | Line 77 | public class ForkJoinWorkerThread extend
77       * @throws NullPointerException if pool is null
78       */
79      protected ForkJoinWorkerThread(ForkJoinPool pool) {
80 <        this(null, pool, false);
80 >        this(null, pool, false, false);
81      }
82  
83      /**
# Line 163 | Line 167 | public class ForkJoinWorkerThread extend
167          @SuppressWarnings("removal")
168          private static final AccessControlContext innocuousACC;
169          InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
170 <            super(innocuousThreadGroup, pool, true);
170 >            super(innocuousThreadGroup, pool, true, true);
171          }
172  
173          @Override @SuppressWarnings("removal")
# Line 173 | Line 177 | public class ForkJoinWorkerThread extend
177                  w.setInnocuous();
178              Thread t = Thread.currentThread();
179              ThreadLocalRandom.setInheritedAccessControlContext(t, innocuousACC);
176            ThreadLocalRandom.eraseThreadLocals(t);
180          }
181  
182          @Override // to silently fail

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines