Java Phaser arriveAndAwaitAdvance() MethodThe arriveAndAwaitAdvance() method returns the arrival phase number, or the negative current phase (if terminated). Using this method, the current phaser arrives, and other phaser waits in the queue. Syntax:Return:It returns current phaser number. Throws:IllegalStateException - This Exception is thrown when the number of unarrived parties is negative. Example 1Test it NowOutput: Thread is sleeping Thread-0 arrived Thread-1 arrived Final Phase count after arrival of Thread is 0 Thread-2 arrived Thread-4 arrived Thread-5 arrived Thread-3 arrived Example 2Test it NowOutput: Phaser Object is register... Initial Phase count is 0 Thread-0 arrived Next TopicJava Phaser |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India