Java Phaser arrive() Method

21 Mar 2025 | 1 min read

The arrive() method of Phaser class is used to notify the arrival of the current phaser, without waiting for the other phasers to arrive.

Syntax:

Return:

It returns arrival of the current phaser number.

Throws:

IllegalStateException - this Exception is thrown when the number of unarrived parties is negative.

Example 1

Output:

 Thread is sleeping Thread-0 arrived Thread-2 arrived Thread-1 arrived Thread-3 arrived Thread-4 arrived Thread-5 arrived Final Phase count after arrival of Thread is 0 

Example 2

Output:

 Thread is sleeping Final Phase count after arrival of Thread is 0 Thread-1 arrived Thread-0 arrived 
 
Next TopicJava Phaser