Package org.agrona.concurrent
Class CachedEpochClock
java.lang.Object
org.agrona.concurrent.CachedEpochClock
- All Implemented Interfaces:
EpochClock
An
EpochClock that caches a timestamp which can be updated with update(long).
Instances are threadsafe with the read being volatile.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
timeMs
protected volatile long timeMsTime in milliseconds.
-
-
Constructor Details
-
CachedEpochClock
public CachedEpochClock()Create a new instance.
-
-
Method Details
-
time
public long time()Time in milliseconds since 1 Jan 1970 UTC.- Specified by:
timein interfaceEpochClock- Returns:
- the number of milliseconds since 1 Jan 1970 UTC.
- See Also:
-
update
public void update(long timeMs) Update the value of the timestamp in with release ordered semantics.- Parameters:
timeMs- value to update the timestamp.
-
advance
public void advance(long millis) Advance the value of the timestamp in with release ordered semantics.- Parameters:
millis- to advance the timestamp.
-