Java Phaser forceTermination() Method

The forceTermination() method is of Phaser class. This method forces the current phaser to come in termination state.

Syntax

Example 1

Test it Now

Output:

Phaser Object is register...
Thread-0 arrived
Thread-0 Terminated:

Example 2

Test it Now

Output:

Phaser Object is register...
Thread-0 arrived
Thread-0 Terminated:
Thread-1 arrived
Thread-1 Terminated:
Thread-2 arrived
Thread-2 Terminated:
Thread-3 arrived
Thread-3 Terminated:
Thread-4 arrived
Thread-4 Terminated:
Thread-5 arrived
Thread-5 Terminated:

Next TopicJava Phaser




Latest Courses