1.

What Is Phaser In Java Concurrency?

Answer»

Phaser is more suitable for use where it is required to synchronize threads over one or more phases of ACTIVITY. THOUGH Phaser can be used to synchronize a single phase, in that case it ACTS more LIKE a CYCLICBARRIER.

Phaser is reusable (like CyclicBarrier) and more flexible in usage.

The number of parties registered to synchronize on a phaser may vary over time. Tasks may be registered at any time (using methods register(), bulkRegister(int), or by specifying initial number of parties in the constructor). Tasks may also be optionally deregistered upon any arrival (using arriveAndDeregister()).

Phaser is more suitable for use where it is required to synchronize threads over one or more phases of activity. Though Phaser can be used to synchronize a single phase, in that case it acts more like a CyclicBarrier.

Phaser is reusable (like CyclicBarrier) and more flexible in usage.

The number of parties registered to synchronize on a phaser may vary over time. Tasks may be registered at any time (using methods register(), bulkRegister(int), or by specifying initial number of parties in the constructor). Tasks may also be optionally deregistered upon any arrival (using arriveAndDeregister()).



Discussion

No Comment Found