Forcing the termination of Phaser

When phaser has zero participants, it enters a state denoted by termination. The Phaser class provides forceTermination() to change the status of phaser and makes it enter the termination state independently of the number of participants registered in phaser. This mechanism may be useful when one of the participants has an error situation, where the best thing to do would be to terminate phaser.

When phaser is in the termination state, the awaitAdvance() and arriveAndAwaitAdvance() methods immediately return a negative number, instead of a positive one that is returned normally. If you know that your phaser could be terminated, you should verify the return value of those methods (awaitAdvance() and arriveAndAwaitAdvance()) to know whether phaser has been terminated.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.104.181