In this recipe, we implemented a phased task in the Task class. This phased task has three phases and uses a Phaser interface to synchronize with other Task objects. The main class launches three tasks, and when these tasks execute their respective phases, it prints information about the status of the phaser object to the console. We used the following methods to get the status of the phaser object:
- getPhase(): This method returns the actual phase of a phaser object
- getRegisteredParties(): This method returns the number of tasks that use a phaser object as a mechanism of synchronization
- getArrivedParties(): This method returns the number of tasks that have arrived at the end of the actual phase
- getUnarrivedParties(): This ...