public interface TimeGenerator
Basically there are two ways to make the time generation monotonically increasing: i). lock provider to guard the time generation with mutex, along with a max allowed clock skew on distributed hosts; ii). TrueTime API that behaves like Google Spanner Time Service, the service itself can ensure the monotonicity. Currently only AWS supplies an SDK for the TrueTime generation.
| Modifier and Type | Method and Description |
|---|---|
void |
consumeTimestamp(boolean skipLocking,
Consumer<Long> func)
Passes an auto generated timestamp to the given function
func. |
long |
currentTimeMillis(boolean skipLocking)
Generates a globally monotonically increasing timestamp.
|
long currentTimeMillis(boolean skipLocking)
skipLocking - If this is triggered by another parent transaction, locking can be skipped.void consumeTimestamp(boolean skipLocking,
Consumer<Long> func)
func. The implementations
need to ensure timestamp generation and executing func are atomic.skipLocking - If this is triggered by another parent transaction, locking can be skipped.func - A consumer that takes a monotonically increasing timestamp.Copyright © 2024 The Apache Software Foundation. All rights reserved.