6 |
|
|
7 |
|
package jsr166y; |
8 |
|
|
9 |
– |
import java.util.concurrent.*; |
9 |
|
import java.util.ArrayList; |
10 |
|
import java.util.Arrays; |
11 |
|
import java.util.Collection; |
428 |
|
|
429 |
|
/** |
430 |
|
* The wakeup interval (in nanoseconds) for the oldest worker |
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. |
431 |
> |
* waiting for an event to invoke tryShutdownUnusedWorker to |
432 |
> |
* shrink the number of workers. The exact value does not matter |
433 |
> |
* too much. It must be short enough to release resources during |
434 |
> |
* sustained periods of idleness, but not so short that threads |
435 |
> |
* are continually re-created. |
436 |
|
*/ |
437 |
|
private static final long SHRINK_RATE_NANOS = |
438 |
|
30L * 1000L * 1000L * 1000L; // 2 per minute |
604 |
|
* (rarely) necessary when other count updates lag. |
605 |
|
* |
606 |
|
* @param dr -- either zero or ONE_RUNNING |
607 |
< |
* @param dt == either zero or ONE_TOTAL |
607 |
> |
* @param dt -- either zero or ONE_TOTAL |
608 |
|
*/ |
609 |
|
private void decrementWorkerCounts(int dr, int dt) { |
610 |
|
for (;;) { |