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

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.29 by jsr166, Mon Sep 6 21:36:44 2010 UTC vs.
Revision 1.30 by jsr166, Tue Sep 7 06:19:05 2010 UTC

# Line 299 | Line 299 | public class ForkJoinPool extends Abstra
299       * about the same time as another is needlessly being created. We
300       * counteract this and related slop in part by requiring resumed
301       * spares to immediately recheck (in preStep) to see whether they
302 <     * they should re-suspend.
302 >     * should re-suspend.
303       *
304       * 6. Killing off unneeded workers. A timeout mechanism is used to
305       * shed unused workers: The oldest (first) event queue waiter uses
# Line 428 | Line 428 | public class ForkJoinPool extends Abstra
428  
429      /**
430       * The wakeup interval (in nanoseconds) for the oldest worker
431 <     * worker waiting for an event invokes tryShutdownUnusedWorker to shrink
431 >     * waiting for an event invokes tryShutdownUnusedWorker to shrink
432       * the number of workers.  The exact value does not matter too
433       * much, but should be long enough to slowly release resources
434       * during long periods without use without disrupting normal use.
# Line 1124 | Line 1124 | public class ForkJoinPool extends Abstra
1124      }
1125  
1126      /**
1127 <     * Clear out and cancel submissions, ignoring exceptions
1127 >     * Clears out and cancels submissions, ignoring exceptions.
1128       */
1129      private void cancelSubmissions() {
1130          ForkJoinTask<?> task;
# Line 1139 | Line 1139 | public class ForkJoinPool extends Abstra
1139      // misc support for ForkJoinWorkerThread
1140  
1141      /**
1142 <     * Returns pool number
1142 >     * Returns pool number.
1143       */
1144      final int getPoolNumber() {
1145          return poolNumber;
1146      }
1147  
1148      /**
1149 <     * Tries to accumulates steal count from a worker, clearing
1150 <     * the worker's value.
1149 >     * Tries to accumulate steal count from a worker, clearing
1150 >     * the worker's value if successful.
1151       *
1152       * @return true if worker steal count now zero
1153       */
# Line 1171 | Line 1171 | public class ForkJoinPool extends Abstra
1171          int pc = parallelism; // use parallelism, not rc
1172          int ac = runState;    // no mask -- artificially boosts during shutdown
1173          // Use exact results for small values, saturate past 4
1174 <        return pc <= ac? 0 : pc >>> 1 <= ac? 1 : pc >>> 2 <= ac? 3 : pc >>> 3;
1174 >        return ((pc <= ac) ? 0 :
1175 >                (pc >>> 1 <= ac) ? 1 :
1176 >                (pc >>> 2 <= ac) ? 3 :
1177 >                pc >>> 3);
1178      }
1179  
1180      // Public and protected methods

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines