Phaser Class Flashcards Preview

OCP > Phaser Class > Flashcards

Flashcards in Phaser Class Deck (10):
1

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)

2

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()

3

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)

4

Arrives at this phase without waiting for other threads to arrive. Returns the arrival phase number. Can throw an IllegalStateException.

int arrive()

5

Same as arrive() but also deregisters from the phaser object.

int arriveAndDeregister()

6

Arrives at this phase and blocks until other threads arrive.

int arriveAndAwaitAdvance()

7

Blocks until this Phaser object advances to the given phase value.

int awaitAdvance(int phase)

8

Returns the number of threads (parties) registered with this phaser object.

int getRegisteredParties()

9

Returns the number of threads (parties) arrived at the current phase of the Phaser object.

int getArrivedParties()

10

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()