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

Comparing jsr166/src/jsr166e/ForkJoinWorkerThread.java (file contents):
Revision 1.1 by dl, Mon Aug 13 15:52:33 2012 UTC vs.
Revision 1.2 by dl, Wed Nov 14 17:20:29 2012 UTC

# Line 31 | Line 31 | public class ForkJoinWorkerThread extend
31      final ForkJoinPool pool;                // the pool this thread works in
32  
33      /**
34 +     * An initial name for a newly constructed worker, used until
35 +     * onStart can establish a useful name. This removes need to
36 +     * establish a name from worker startup path.
37 +     */
38 +    static final String provisionalName = "aForkJoinWorkerThread";
39 +
40 +    /**
41       * Creates a ForkJoinWorkerThread operating in the given pool.
42       *
43       * @param pool the pool this thread works in
44       * @throws NullPointerException if pool is null
45       */
46      protected ForkJoinWorkerThread(ForkJoinPool pool) {
47 <        super(pool.nextWorkerName());
41 <        setDaemon(true);
47 >        super(provisionalName); // bootstrap name
48          Thread.UncaughtExceptionHandler ueh = pool.ueh;
49          if (ueh != null)
50              setUncaughtExceptionHandler(ueh);
51 +        setDaemon(true);
52          this.pool = pool;
53          pool.registerWorker(this.workQueue = new ForkJoinPool.WorkQueue
54                              (pool, this, pool.localMode));
# Line 79 | Line 86 | public class ForkJoinWorkerThread extend
86       * processing tasks.
87       */
88      protected void onStart() {
89 +        String pref; // replace bootstrap name
90 +        if (provisionalName.equals(getName()) &&
91 +            (pref = pool.workerNamePrefix) != null)
92 +            setName(pref.concat(Long.toString(getId())));
93      }
94  
95      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines