Java Phaser bulkRegister() MethodThe bulkRegister() method is of Phaser class. This method Adds the given number of new unarrived parties to this phaser. SyntaxParametersparties - It is the number of parties to add in advance to the next phase. ReturnIt returns the number of arrival phase to which this registration applied. ThrowsIllegalStateException - It throws exception if tried to register more than the maximum number of parties. IllegalArgumentException - It throws exception if parties less than 0. Example 1Test it NowOutput: Phasecount is 0 Unarrived parties to current phaser : 0 Thread-0 arrived Unarrived parties to current phaser : 0 Thread-1 arrived Thread-2 arrived Unarrived parties to current phaser : 0 Unarrived parties to current phaser : 0 Unarrived parties to current phaser : 0 Thread-4 arrived Thread-3 arrived Phasecount is 0 Example 2Test it NowOutput: Phasecount is 0 Unarrived parties to current phaser : 0 Unarrived parties to current phaser : 0 Thread-0 arrived Thread-1 arrived Phasecount is 0 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