There's more...

The Phaser class provides other methods related to the change of phase. These methods are as follows:

  • arrive(): This method notifies the Phaser class that one participant has finished the actual phase but it should not wait for the rest of the participants to continue with their execution. Be careful with the utilization of this method because it doesn't synchronize with other threads.
  • awaitAdvance(int phase): This method puts the current thread to sleep until all the participants of the phaser parameter have finished the current phase, that is, if the number we pass as the parameter is equal to the actual phase of phaser. If the parameter and the actual phase of phaser aren't equal, the method  ends its execution.
  • awaitAdvanceInterruptibly(int phaser): This method is equal to the method explained earlier, but it throws an InterruptedException exception if the thread that is sleeping in this method is interrupted.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.151.252