Java Phaser arriveAndDeregister() MethodThe arriveAndDeregister () method is of Phaser class. This method deregisters the current phaser on its arrival, without waiting for the other phaser to arrive which are in the queue. Syntax:Return:It returns the arrival phaser number. Throws:IllegalStateException - this Exception is thrown when the number of unarrived parties is negative. Example 1Test it NowOutput: Thread is sleeping Final Phase count after arrival of Thread is 0 Thread-0 arrived Thread Arrive And Deregister... Example 2Test it NowOutput: Thread is sleeping Thread-2 arrived Thread Arrive And Deregister... Thread-1 arrived Thread Arrive And Deregister... Thread-3 arrived Thread Arrive And Deregister... Thread-5 arrived Thread Arrive And Deregister... Thread-0 arrived Thread Arrive And Deregister... Thread-4 arrived Thread Arrive And Deregister... Final Phase count after arrival of Thread 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