Package org.agrona.concurrent.status
Class Position
- java.lang.Object
-
- org.agrona.concurrent.status.ReadablePosition
-
- org.agrona.concurrent.status.Position
-
- All Implemented Interfaces:
java.lang.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 unless methods with plain memory semantics are used.
-
-
Constructor Summary
Constructors Constructor Description Position()
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract boolean
isClosed()
Has this Position been closed?abstract boolean
proposeMax(long proposedValue)
Set the position to a new proposedValue if greater than the current value with plain memory semantics.abstract boolean
proposeMaxOpaque(long proposedValue)
Set the position to the new proposedValue if greater than the current value with opaque memory semantics.abstract boolean
proposeMaxOrdered(long proposedValue)
Set the position to the new proposedValue if greater than the current value with release memory semantics.abstract boolean
proposeMaxRelease(long proposedValue)
Set the position to the new proposedValue if greater than the current value with release memory semantics.abstract void
set(long value)
Sets the current position of the component plain memory semantics.abstract void
setOpaque(long value)
Sets the current position of the component with opaque memory semantics.abstract void
setOrdered(long value)
Sets the current position of the component with ordered memory semantics.abstract void
setRelease(long value)
Sets the current position of the component with release 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, get, getAcquire, getOpaque, getVolatile, id
-
-
-
-
Method Detail
-
isClosed
public abstract boolean isClosed()
Has this Position been closed?- Returns:
- true if this position has already been closed.
-
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.
-
setOrdered
public abstract void setOrdered(long value)
Sets the current position of the component with ordered memory semantics.This method is identical to
setRelease(long)
and that method should be used instead.- Parameters:
value
- the current position of the component.
-
setRelease
public abstract void setRelease(long value)
Sets the current position of the component with release memory semantics.- Parameters:
value
- the current position of the component.- Since:
- 2.1.0
-
setOpaque
public abstract void setOpaque(long value)
Sets the current position of the component with opaque memory semantics.- Parameters:
value
- the current position of the component.- Since:
- 2.1.0
-
set
public abstract void set(long value)
Sets the current position of the component plain 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 with plain memory 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 release memory semantics.This method is identical to
proposeMaxRelease(long)
and that method should be preferred instead.- Parameters:
proposedValue
- for the new max.- Returns:
- true if a new max as been set otherwise false.
-
proposeMaxRelease
public abstract boolean proposeMaxRelease(long proposedValue)
Set the position to the new proposedValue if greater than the current value with release memory semantics.- Parameters:
proposedValue
- for the new max.- Returns:
- true if a new max as been set otherwise false.
-
proposeMaxOpaque
public abstract boolean proposeMaxOpaque(long proposedValue)
Set the position to the new proposedValue if greater than the current value with opaque memory semantics.- Parameters:
proposedValue
- for the new max.- Returns:
- true if a new max as been set otherwise false.
-
-