Class OpOrder.Barrier

java.lang.Object
org.apache.cassandra.utils.concurrent.OpOrder.Barrier
Enclosing class:
OpOrder

public final class OpOrder.Barrier extends 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
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    wait for all operations started prior to issuing the barrier to complete
    returns the Group we are waiting on - any Group with .compareTo(getSyncPoint()) <= 0 must complete before await() returns
    boolean
     
    void
    Issues (seals) the barrier, meaning no new operations may be issued against it, and expires the current Group.
    void
    Mark all prior operations as blocking, potentially signalling them to more aggressively make progress

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Barrier

      public Barrier()
  • Method Details

    • 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
    • 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