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.84 by dl, Fri Apr 29 17:00:36 2022 UTC vs.
Revision 1.85 by dl, Fri May 6 16:03:05 2022 UTC

# Line 43 | Line 43 | public class ForkJoinWorkerThread extend
43       * Full nonpublic constructor.
44       */
45      ForkJoinWorkerThread(ThreadGroup group, ForkJoinPool pool,
46 <                         boolean useSystemClassLoader, boolean isInnocuous) {
47 <        super(group, null, pool.nextWorkerThreadName(), 0L, !isInnocuous);
46 >                         boolean useSystemClassLoader,
47 >                         boolean clearThreadLocals) {
48 >        super(group, null, pool.nextWorkerThreadName(), 0L, !clearThreadLocals);
49          UncaughtExceptionHandler handler = (this.pool = pool).ueh;
50          this.workQueue = new ForkJoinPool.WorkQueue(this, 0);
51 +        if (clearThreadLocals)
52 +            workQueue.setClearThreadLocals();
53          super.setDaemon(true);
54          if (handler != null)
55              super.setUncaughtExceptionHandler(handler);
# Line 58 | Line 61 | public class ForkJoinWorkerThread extend
61       * Creates a ForkJoinWorkerThread operating in the given thread group and
62       * pool, and with the given policy for preserving ThreadLocals.
63       *
64 <     * @param group if non-null, the thread group for this thread
64 >     * @param group if non-null, the thread group for this
65 >     * thread. Otherwise, the thread group is chosen by the security
66 >     * manager if present, else set to the current thread's thread
67 >     * group.
68       * @param pool the pool this thread works in
69       * @param preserveThreadLocals if true, always preserve the values of
70       * ThreadLocal variables across tasks; otherwise they may be cleared.
# Line 158 | Line 164 | public class ForkJoinWorkerThread extend
164      /**
165       * A worker thread that has no permissions, is not a member of any
166       * user-defined ThreadGroup, uses the system class loader as
167 <     * thread context class loader, and erases all ThreadLocals after
167 >     * thread context class loader, and clears all ThreadLocals after
168       * running each top-level task.
169       */
170      static final class InnocuousForkJoinWorkerThread extends ForkJoinWorkerThread {
# Line 172 | Line 178 | public class ForkJoinWorkerThread extend
178  
179          @Override @SuppressWarnings("removal")
180          protected void onStart() {
175            ForkJoinPool.WorkQueue w = workQueue;
176            if (w != null)
177                w.setInnocuous();
181              Thread t = Thread.currentThread();
182              ThreadLocalRandom.setInheritedAccessControlContext(t, innocuousACC);
183          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines