31 |
|
* registered. (However, you can introduce such bookkeeping by |
32 |
|
* subclassing this class.) |
33 |
|
* |
34 |
< |
* <li> Each generation has an associated phase value, starting at |
35 |
< |
* zero, and advancing when all parties arrive at the barrier |
36 |
< |
* (wrapping around to zero after reaching {@code Integer.MAX_VALUE}). |
34 |
> |
* <li> Each generation has an associated phase number. The phase |
35 |
> |
* number starts at zero, amd advances when all parties arrive at the |
36 |
> |
* barrier, wrapping around to zero after reaching {@code |
37 |
> |
* Integer.MAX_VALUE}. |
38 |
|
* |
39 |
|
* <li> Like a {@code CyclicBarrier}, a phaser may be repeatedly |
40 |
|
* awaited. Method {@link #arriveAndAwaitAdvance} has effect |
55 |
|
* when the barrier advances to a new phase. |
56 |
|
* </ul> |
57 |
|
* |
57 |
– |
* |
58 |
|
* <li> Barrier actions, performed by the task triggering a phase |
59 |
|
* advance, are arranged by overriding method {@link #onAdvance(int, |
60 |
|
* int)}, which also controls termination. Overriding this method is |
90 |
|
* ForkJoinPool}, which will ensure sufficient parallelism to execute |
91 |
|
* tasks when others are blocked waiting for a phase to advance. |
92 |
|
* |
93 |
+ |
* <li>The current state of a phaser may be monitored. At any given |
94 |
+ |
* moment there are {@link #getRegisteredParties}, where {@link |
95 |
+ |
* #getArrivedParties} have arrived at the current phase ({@link |
96 |
+ |
* #getPhase}). When the remaining {@link #getUnarrivedParties}) |
97 |
+ |
* arrive, the phase advances. Method {@link #toString} returns |
98 |
+ |
* snapshots of these state queries in a form convenient for |
99 |
+ |
* informal monitoring. |
100 |
+ |
* |
101 |
|
* </ul> |
102 |
|
* |
103 |
|
* <p><b>Sample usages:</b> |
674 |
|
} |
675 |
|
|
676 |
|
/** |
677 |
< |
* Returns the number of parties that have arrived at the current |
678 |
< |
* phase of this barrier. |
677 |
> |
* Returns the number of registered parties that have arrived at |
678 |
> |
* the current phase of this barrier. |
679 |
|
* |
680 |
|
* @return the number of arrived parties |
681 |
|
*/ |