Phaser Class Flashcards
Constructor that creates a Phaser object with no registered parties and no parents. The initial phase is set to zero. Has an overloaded version that takes the number of threads that need to arrive to advance to the next stage.
Phaser(), Phaser(int numThreads)
Adds a new thread to this Phaser object. Returns the phase current number. Throws an IllegalStateException if the maximum supported parties are already registered.
int register()
Adds numThreads of unarrived parties to this phaser object. Returns the current phase number. Throws an IllegalStateException if maximum supported parties are already registerd.
int bulkRegister(int numThreads)
Arrives at this phase without waiting for other threads to arrive. Returns the arrival phase number. Can throw an IllegalStateException.
int arrive()
Same as arrive() but also deregisters from the phaser object.
int arriveAndDeregister()
Arrives at this phase and blocks until other threads arrive.
int arriveAndAwaitAdvance()
Blocks until this Phaser object advances to the given phase value.
int awaitAdvance(int phase)
Returns the number of threads (parties) registered with this phaser object.
int getRegisteredParties()
Returns the number of threads (parties) arrived at the current phase of the Phaser object.
int getArrivedParties()
Returns the number of threads (parties) that have not arrived when compared to the registered parties at the current phase of the Phaser object.
int getUnarrivedParties()