121 |
|
private int count; |
122 |
|
|
123 |
|
/** |
124 |
< |
* Update state on barrier trip and wake up everyone. |
124 |
> |
* Updates state on barrier trip and wake up everyone. |
125 |
|
*/ |
126 |
|
private void nextGeneration() { |
127 |
|
count = parties; |
130 |
|
} |
131 |
|
|
132 |
|
/** |
133 |
< |
* Set barrier as broken and wake up everyone |
133 |
> |
* Sets barrier as broken and wake up everyone |
134 |
|
*/ |
135 |
|
private void breakBarrier() { |
136 |
|
broken = true; |
201 |
|
} |
202 |
|
|
203 |
|
/** |
204 |
< |
* Create a new <tt>CyclicBarrier</tt> that will trip when the |
204 |
> |
* Creates a new <tt>CyclicBarrier</tt> that will trip when the |
205 |
|
* given number of parties (threads) are waiting upon it, and which |
206 |
|
* will execute the given barrier action when the barrier is tripped, |
207 |
|
* performed by the last thread entering the barrier. |
221 |
|
} |
222 |
|
|
223 |
|
/** |
224 |
< |
* Create a new <tt>CyclicBarrier</tt> that will trip when the |
224 |
> |
* Creates a new <tt>CyclicBarrier</tt> that will trip when the |
225 |
|
* given number of parties (threads) are waiting upon it, and |
226 |
|
* does not perform a predefined action upon each barrier. |
227 |
|
* |
235 |
|
} |
236 |
|
|
237 |
|
/** |
238 |
< |
* Return the number of parties required to trip this barrier. |
238 |
> |
* Returns the number of parties required to trip this barrier. |
239 |
|
* @return the number of parties required to trip this barrier. |
240 |
|
**/ |
241 |
|
public int getParties() { |
243 |
|
} |
244 |
|
|
245 |
|
/** |
246 |
< |
* Wait until all {@link #getParties parties} have invoked <tt>await</tt> |
246 |
> |
* Waits until all {@link #getParties parties} have invoked <tt>await</tt> |
247 |
|
* on this barrier. |
248 |
|
* |
249 |
|
* <p>If the current thread is not the last to arrive then it is |
304 |
|
} |
305 |
|
|
306 |
|
/** |
307 |
< |
* Wait until all {@link #getParties parties} have invoked <tt>await</tt> |
307 |
> |
* Waits until all {@link #getParties parties} have invoked <tt>await</tt> |
308 |
|
* on this barrier. |
309 |
|
* |
310 |
|
* <p>If the current thread is not the last to arrive then it is |
368 |
|
} |
369 |
|
|
370 |
|
/** |
371 |
< |
* Query if this barrier is in a broken state. |
371 |
> |
* Queries if this barrier is in a broken state. |
372 |
|
* @return <tt>true</tt> if one or more parties broke out of this |
373 |
|
* barrier due to interruption or timeout since construction or |
374 |
|
* the last reset, or a barrier action failed due to an exception; |
385 |
|
} |
386 |
|
|
387 |
|
/** |
388 |
< |
* Reset the barrier to its initial state. If any parties are |
388 |
> |
* Resets the barrier to its initial state. If any parties are |
389 |
|
* currently waiting at the barrier, they will return with a |
390 |
|
* {@link BrokenBarrierException}. Note that resets <em>after</em> |
391 |
|
* a breakage has occurred for other reasons can be complicated to |
412 |
|
} |
413 |
|
|
414 |
|
/** |
415 |
< |
* Return the number of parties currently waiting at the barrier. |
415 |
> |
* Returns the number of parties currently waiting at the barrier. |
416 |
|
* This method is primarily useful for debugging and assertions. |
417 |
|
* |
418 |
|
* @return the number of parties currently blocked in {@link #await} |