Class Position

All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
AtomicLongPosition, UnsafeBufferPosition

public abstract class Position extends ReadablePosition
Reports on how far through a buffer some component has progressed.

Threadsafe to write to from a single writer.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract long
    get()
    Get the current position of a component without memory ordering semantics.
    abstract boolean
    Has this Position been closed?
    abstract boolean
    proposeMax(long proposedValue)
    Set the position to a new proposedValue if greater than the current value without memory ordering semantics.
    abstract boolean
    proposeMaxOrdered(long proposedValue)
    Set the position to the new proposedValue if greater than the current value with memory ordering semantics.
    abstract void
    set(long value)
    Sets the current position of the component without memory ordering semantics.
    abstract void
    setOrdered(long value)
    Sets the current position of the component with ordered memory semantics.
    abstract void
    setVolatile(long value)
    Sets the current position of the component with volatile memory semantics.

    Methods inherited from class org.agrona.concurrent.status.ReadablePosition

    close, getVolatile, id

    Methods inherited from class java.lang.Object

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

    • Position

      public Position()
  • Method Details

    • isClosed

      public abstract boolean isClosed()
      Has this Position been closed?
      Returns:
      true if this position has already been closed.
    • get

      public abstract long get()
      Get the current position of a component without memory ordering semantics.
      Returns:
      the current position of a component
    • set

      public abstract void set(long value)
      Sets the current position of the component without memory ordering semantics.
      Parameters:
      value - the current position of the component.
    • setOrdered

      public abstract void setOrdered(long value)
      Sets the current position of the component with ordered memory semantics.
      Parameters:
      value - the current position of the component.
    • setVolatile

      public abstract void setVolatile(long value)
      Sets the current position of the component with volatile memory semantics.
      Parameters:
      value - the current position of the component.
    • proposeMax

      public abstract boolean proposeMax(long proposedValue)
      Set the position to a new proposedValue if greater than the current value without memory ordering semantics.
      Parameters:
      proposedValue - for the new max.
      Returns:
      true if a new max as been set otherwise false.
    • proposeMaxOrdered

      public abstract boolean proposeMaxOrdered(long proposedValue)
      Set the position to the new proposedValue if greater than the current value with memory ordering semantics.
      Parameters:
      proposedValue - for the new max.
      Returns:
      true if a new max as been set otherwise false.