Java Phaser getParent() MethodThe getParent() method of Phaser class is used to get the parent of the current phaser. It returns null there is no parent of the current phaser. Syntax:Return:it returns the parent of current phaser Example 1Test it NowOutput: Thread is sleeping Thread-0 arrived Parent Phaser: java.util.concurrent.Phaser@2b71e323[phase = 0 parties = 11 arrived = 1] Example 2Test it NowOutput: Thread-1 arrived Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 1] Thread-4 arrived Thread-3 arrived Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 3] Thread-0 arrived Thread-2 arrived Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 5] Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 4] Thread-5 arrived Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 2] Parent Phaser: java.util.concurrent.Phaser@2eaa3bae[phase = 0 parties = 11 arrived = 6] 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