public class TimestampGenerator extends Object
Modifier and Type | Field and Description |
---|---|
static long |
TS_MULTIPLIER |
Constructor and Description |
---|
TimestampGenerator() |
Modifier and Type | Method and Description |
---|---|
long |
currentTime()
Returns the current wall clock time in milliseconds, multiplied by the
required precision.
|
static long |
getSupplementedTimestamp(long incomingTS,
String appId)
Returns a timestamp multiplied with TS_MULTIPLIER and last few digits of
application id.
|
static long |
getTruncatedTimestamp(long incomingTS)
truncates the last few digits of the timestamp which were supplemented by
the TimestampGenerator#getSupplementedTimestamp function.
|
long |
getUniqueTimestamp()
Returns a timestamp value unique within the scope of this
TimestampGenerator instance. |
public static final long TS_MULTIPLIER
public long currentTime()
public long getUniqueTimestamp()
TimestampGenerator
instance. For usage by HBase
RegionObserver
coprocessors, this normally means unique within a
given region.
Unlikely scenario of generating a non-unique timestamp: if there is a
sustained rate of more than 1M hbase writes per second AND if region fails
over within that time range of timestamps being generated then there may be
collisions writing to a cell version of the same column.public static long getSupplementedTimestamp(long incomingTS, String appId)
incomingTS
- Timestamp to be converted.appId
- Application Id.public static long getTruncatedTimestamp(long incomingTS)
incomingTS
- Timestamp to be truncated.Copyright © 2022 Apache Software Foundation. All rights reserved.