public class CachedEpochClock extends Object implements EpochClock
EpochClock
that caches a timestamp which can be updated with update(long)
.
Instances are threadsafe with the read being volatile.
Modifier and Type | Field and Description |
---|---|
protected long |
timeMs |
Constructor and Description |
---|
CachedEpochClock() |
Modifier and Type | Method and Description |
---|---|
void |
advance(long millis)
Advance the value of the timestamp in with release ordered semantics.
|
long |
time()
Time in milliseconds since 1 Jan 1970 UTC.
|
void |
update(long timeMs)
Update the value of the timestamp in with release ordered semantics.
|
public long time()
time
in interface EpochClock
public void update(long timeMs)
timeMs
- value to update the timestamp.public void advance(long millis)
millis
- to advance the timestamp.Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.