16 |
|
* <em>cyclic</em> because it can be re-used after the waiting threads |
17 |
|
* are released. |
18 |
|
* |
19 |
< |
* <p>A <tt>CyclicBarrier</tt> supports an optional {@link Runnable} command |
19 |
> |
* <p>A {@code CyclicBarrier} supports an optional {@link Runnable} command |
20 |
|
* that is run once per barrier point, after the last thread in the party |
21 |
|
* arrives, but before any threads are released. |
22 |
|
* This <em>barrier action</em> is useful |
73 |
|
* barrier until all rows have been processed. When all rows are processed |
74 |
|
* the supplied {@link Runnable} barrier action is executed and merges the |
75 |
|
* rows. If the merger |
76 |
< |
* determines that a solution has been found then <tt>done()</tt> will return |
77 |
< |
* <tt>true</tt> and each worker will terminate. |
76 |
> |
* determines that a solution has been found then {@code done()} will return |
77 |
> |
* {@code true} and each worker will terminate. |
78 |
|
* |
79 |
|
* <p>If the barrier action does not rely on the parties being suspended when |
80 |
|
* it is executed, then any of the threads in the party could execute that |
87 |
|
* // log the completion of this iteration |
88 |
|
* }}</pre> |
89 |
|
* |
90 |
< |
* <p>The <tt>CyclicBarrier</tt> uses an all-or-none breakage model |
90 |
> |
* <p>The {@code CyclicBarrier} uses an all-or-none breakage model |
91 |
|
* for failed synchronization attempts: If a thread leaves a barrier |
92 |
|
* point prematurely because of interruption, failure, or timeout, all |
93 |
|
* other threads waiting at that barrier point will also leave |
114 |
|
* is reset. There can be many generations associated with threads |
115 |
|
* using the barrier - due to the non-deterministic way the lock |
116 |
|
* may be allocated to waiting threads - but only one of these |
117 |
< |
* can be active at a time (the one to which <tt>count</tt> applies) |
117 |
> |
* can be active at a time (the one to which {@code count} applies) |
118 |
|
* and all the rest are either broken or tripped. |
119 |
|
* There need not be an active generation if there has been a break |
120 |
|
* but no subsequent reset. |
234 |
|
} |
235 |
|
|
236 |
|
/** |
237 |
< |
* Creates a new <tt>CyclicBarrier</tt> that will trip when the |
237 |
> |
* Creates a new {@code CyclicBarrier} that will trip when the |
238 |
|
* given number of parties (threads) are waiting upon it, and which |
239 |
|
* will execute the given barrier action when the barrier is tripped, |
240 |
|
* performed by the last thread entering the barrier. |
253 |
|
} |
254 |
|
|
255 |
|
/** |
256 |
< |
* Creates a new <tt>CyclicBarrier</tt> that will trip when the |
256 |
> |
* Creates a new {@code CyclicBarrier} that will trip when the |
257 |
|
* given number of parties (threads) are waiting upon it, and |
258 |
|
* does not perform a predefined action when the barrier is tripped. |
259 |
|
* |
276 |
|
|
277 |
|
/** |
278 |
|
* Waits until all {@linkplain #getParties parties} have invoked |
279 |
< |
* <tt>await</tt> on this barrier. |
279 |
> |
* {@code await} on this barrier. |
280 |
|
* |
281 |
|
* <p>If the current thread is not the last to arrive then it is |
282 |
|
* disabled for thread scheduling purposes and lies dormant until |
301 |
|
* |
302 |
|
* <p>If the barrier is {@link #reset} while any thread is waiting, |
303 |
|
* or if the barrier {@linkplain #isBroken is broken} when |
304 |
< |
* <tt>await</tt> is invoked, or while any thread is waiting, then |
304 |
> |
* {@code await} is invoked, or while any thread is waiting, then |
305 |
|
* {@link BrokenBarrierException} is thrown. |
306 |
|
* |
307 |
|
* <p>If any thread is {@linkplain Thread#interrupt interrupted} while waiting, |
338 |
|
|
339 |
|
/** |
340 |
|
* Waits until all {@linkplain #getParties parties} have invoked |
341 |
< |
* <tt>await</tt> on this barrier, or the specified waiting time elapses. |
341 |
> |
* {@code await} on this barrier, or the specified waiting time elapses. |
342 |
|
* |
343 |
|
* <p>If the current thread is not the last to arrive then it is |
344 |
|
* disabled for thread scheduling purposes and lies dormant until |
368 |
|
* |
369 |
|
* <p>If the barrier is {@link #reset} while any thread is waiting, |
370 |
|
* or if the barrier {@linkplain #isBroken is broken} when |
371 |
< |
* <tt>await</tt> is invoked, or while any thread is waiting, then |
371 |
> |
* {@code await} is invoked, or while any thread is waiting, then |
372 |
|
* {@link BrokenBarrierException} is thrown. |
373 |
|
* |
374 |
|
* <p>If any thread is {@linkplain Thread#interrupt interrupted} while |