public class DistributedUniqueTimeProvider
extends net.openhft.chronicle.core.io.SimpleCloseable
implements net.openhft.chronicle.core.time.TimeProvider
Modifier and Type | Method and Description |
---|---|
long |
currentTimeMicros()
This method returns a unique, monotonically increasing microsecond timestamp where
the lowest two digits of the microseconds is the hostId, ensuring uniqueness across different hosts.
|
long |
currentTimeMillis() |
long |
currentTimeNanos()
This method returns a unique, monotonically increasing nanosecond timestamp.
|
DistributedUniqueTimeDeduplicator |
deduplicator()
Deprecated.
|
static DistributedUniqueTimeProvider |
forHostId(int hostId) |
DistributedUniqueTimeProvider |
hostId(int hostId)
Sets the hostId of the DistributedUniqueTimeProvider.
|
static long |
hostIdFor(long timestampWithHostId)
Extract the hostId from the timestampWithHostId
|
static DistributedUniqueTimeProvider |
instance()
Returns an instance of DistributedUniqueTimeProvider.
|
protected void |
performClose() |
DistributedUniqueTimeProvider |
provider(net.openhft.chronicle.core.time.TimeProvider provider)
Sets the TimeProvider of the DistributedUniqueTimeProvider.
|
static long |
timestampFor(long timestampWithHostId)
Extract the timestamp in nanoseconds from the timestampWithHostId
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
referenceId, referenceName, temporary
public static DistributedUniqueTimeProvider instance()
public static DistributedUniqueTimeProvider forHostId(int hostId)
public static long timestampFor(long timestampWithHostId)
timestampWithHostId
- to extract frompublic static long hostIdFor(long timestampWithHostId)
timestampWithHostId
- to extract fromprotected void performClose()
performClose
in class net.openhft.chronicle.core.io.SimpleCloseable
public DistributedUniqueTimeProvider hostId(int hostId)
hostId
- The host identifier, must be non-negative.IllegalArgumentException
- if the provided hostId is negative.public DistributedUniqueTimeProvider provider(net.openhft.chronicle.core.time.TimeProvider provider)
provider
- The TimeProvider instance to be used for fetching the current time.public long currentTimeMillis()
currentTimeMillis
in interface net.openhft.chronicle.core.time.TimeProvider
public long currentTimeMicros() throws IllegalStateException
currentTimeMicros
in interface net.openhft.chronicle.core.time.TimeProvider
IllegalStateException
- if the underlying resources have been released/closedpublic long currentTimeNanos() throws IllegalStateException
currentTimeNanos
in interface net.openhft.chronicle.core.time.TimeProvider
IllegalStateException
- if the underlying resources have been released/closed@Deprecated public DistributedUniqueTimeDeduplicator deduplicator()
Copyright © 2023. All rights reserved.