public class AtomicLongPosition extends Position
Position
that is backed by an AtomicLong
which is useful for tests.Constructor and Description |
---|
AtomicLongPosition()
Default constructor.
|
AtomicLongPosition(int id)
Create a position with a given id and zero as an initial value.
|
AtomicLongPosition(int id,
long initialValue)
Create a position with a given id and an initial value.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
get()
Get the current position of a component without memory ordering semantics.
|
long |
getVolatile()
Get the current position of a component with volatile semantics.
|
int |
id()
Identifier for this position.
|
boolean |
isClosed()
Has this Position been closed?
|
boolean |
proposeMax(long proposedValue)
Set the position to a new proposedValue if greater than the current value without memory ordering semantics.
|
boolean |
proposeMaxOrdered(long proposedValue)
Set the position to the new proposedValue if greater than the current value with memory ordering semantics.
|
void |
set(long value)
Sets the current position of the component without memory ordering semantics.
|
void |
setOrdered(long value)
Sets the current position of the component with ordered memory semantics.
|
void |
setVolatile(long value)
Sets the current position of the component with volatile memory semantics.
|
String |
toString() |
public AtomicLongPosition()
public AtomicLongPosition(int id)
id
- to be assigned.public AtomicLongPosition(int id, long initialValue)
id
- to be assigned.initialValue
- to be assigned.public boolean isClosed()
public int id()
id
in class ReadablePosition
public long get()
public long getVolatile()
getVolatile
in class ReadablePosition
public void set(long value)
public void setOrdered(long value)
setOrdered
in class Position
value
- the current position of the component.public void setVolatile(long value)
setVolatile
in class Position
value
- the current position of the component.public boolean proposeMax(long proposedValue)
proposeMax
in class Position
proposedValue
- for the new max.public boolean proposeMaxOrdered(long proposedValue)
proposeMaxOrdered
in class Position
proposedValue
- for the new max.public void close()
close
in interface AutoCloseable
close
in class ReadablePosition
Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.