org.apache.cassandra.utils.concurrent

## Class OpOrder.Barrier

- java.lang.Object
- - org.apache.cassandra.utils.concurrent.OpOrder.Barrier

- Enclosing class:
    OpOrder

      public final class OpOrder.Barrier
      extends java.lang.Object

  This class represents a synchronisation point providing ordering guarantees on operations started against the enclosing OpOrder. When issue() is called upon it (may only happen once per Barrier), the Barrier atomically partitions new operations from those already running (by expiring the current Group), and activates its isAfter() method which indicates if an operation was started before or after this partition. It offers methods to determine, or block until, all prior operations have finished, and a means to indicate to those operations that they are blocking forward progress. See `OpOrder` for idiomatic usage.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Barrier()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allPriorOpsAreFinished()`
    `void` | `await()` wait for all operations started prior to issuing the barrier to complete
    `OpOrder.Group` | `getSyncPoint()` returns the Group we are waiting on - any Group with .compareTo(getSyncPoint()) <= 0 must complete before await() returns
    `boolean` | `isAfter(OpOrder.Group group)`
    `void` | `issue()` Issues (seals) the barrier, meaning no new operations may be issued against it, and expires the current Group.
    `void` | `markBlocking()` Mark all prior operations as blocking, potentially signalling them to more aggressively make progress
    `WaitQueue.Signal` | `register()` Register to be signalled once allPriorOpsAreFinished() or allPriorOpsAreFinishedOrSafe() may return true

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Barrier

          public Barrier()

  - ### Method Detail

    - #### isAfter

          public boolean isAfter(OpOrder.Group group)

      Returns:
        true if @param group was started prior to the issuing of the barrier. (Until issue is called, always returns true, but if you rely on this behavior you are probably Doing It Wrong.)

    - #### issue

          public void issue()

      Issues (seals) the barrier, meaning no new operations may be issued against it, and expires the current Group. Must be called before await() for isAfter() to be properly synchronised.

    - #### markBlocking

          public void markBlocking()

      Mark all prior operations as blocking, potentially signalling them to more aggressively make progress

    - #### register

          public WaitQueue.Signal register()

      Register to be signalled once allPriorOpsAreFinished() or allPriorOpsAreFinishedOrSafe() may return true

    - #### allPriorOpsAreFinished

          public boolean allPriorOpsAreFinished()

      Returns:
        true if all operations started prior to barrier.issue() have completed

    - #### await

          public void await()

      wait for all operations started prior to issuing the barrier to complete

    - #### getSyncPoint

          public OpOrder.Group getSyncPoint()

      returns the Group we are waiting on - any Group with .compareTo(getSyncPoint()) <= 0 must complete before await() returns

Copyright © 2018 The Apache Software Foundation