762 |
|
} |
763 |
|
|
764 |
|
/** |
765 |
< |
* Overridable method to perform an action upon phase advance, and |
766 |
< |
* to control termination. This method is invoked upon arrival of |
767 |
< |
* the party tripping the barrier (when all other waiting parties |
768 |
< |
* are dormant). If this method returns {@code true}, then, |
769 |
< |
* rather than advance the phase number, this barrier will be set |
770 |
< |
* to a final termination state, and subsequent calls to {@link |
771 |
< |
* #isTerminated} will return true. Any (unchecked) Exception or |
772 |
< |
* Error thrown by an invocation of this method is propagated to |
773 |
< |
* the party attempting to trip the barrier, in which case no |
774 |
< |
* advance occurs. |
765 |
> |
* Overridable method to perform an action upon impending phase |
766 |
> |
* advance, and to control termination. This method is invoked |
767 |
> |
* upon arrival of the party tripping the barrier (when all other |
768 |
> |
* waiting parties are dormant). If this method returns {@code |
769 |
> |
* true}, then, rather than advance the phase number, this barrier |
770 |
> |
* will be set to a final termination state, and subsequent calls |
771 |
> |
* to {@link #isTerminated} will return true. Any (unchecked) |
772 |
> |
* Exception or Error thrown by an invocation of this method is |
773 |
> |
* propagated to the party attempting to trip the barrier, in |
774 |
> |
* which case no advance occurs. |
775 |
|
* |
776 |
|
* <p>The arguments to this method provide the state of the phaser |
777 |
|
* prevailing for the current transition. (When called from within |
785 |
|
* property. |
786 |
|
* |
787 |
|
* <p>You may override this method to perform an action with side |
788 |
< |
* effects visible to participating tasks, but it is in general |
789 |
< |
* only sensible to do so in designs where all parties register |
790 |
< |
* before any arrive, and all {@link #awaitAdvance} at each phase. |
791 |
< |
* Otherwise, you cannot ensure lack of interference from other |
792 |
< |
* parties during the invocation of this method. |
788 |
> |
* effects visible to participating tasks, but doing so requires |
789 |
> |
* care: Method {@code onAdvance} may be invoked more than once |
790 |
> |
* per transition. Further, unless all parties register before |
791 |
> |
* any arrive, and all {@link #awaitAdvance} at each phase, then |
792 |
> |
* you cannot ensure lack of interference from other parties |
793 |
> |
* during the invocation of this method. |
794 |
|
* |
795 |
|
* @param phase the phase number on entering the barrier |
796 |
|
* @param registeredParties the current number of registered parties |