public class BitsAllocator
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
TOTAL_BITS
Total 64 bits
|
| 构造器和说明 |
|---|
BitsAllocator(int timestampBits,
int workerIdBits,
int sequenceBits)
Constructor with timestampBits, workerIdBits, sequenceBits
The highest bit used for sign, so 63 bits for timestampBits, workerIdBits, sequenceBits |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
allocate(long deltaSeconds,
long workerId,
long sequence)
Allocate bits for UID according to delta seconds & workerId & sequence
Note that: The highest bit will always be 0 for sign |
long |
getMaxDeltaSeconds() |
long |
getMaxSequence() |
long |
getMaxWorkerId() |
int |
getSequenceBits() |
int |
getSignBits()
Getters
|
int |
getTimestampBits() |
int |
getTimestampShift() |
int |
getWorkerIdBits() |
int |
getWorkerIdShift() |
java.lang.String |
toString() |
public static final int TOTAL_BITS
public BitsAllocator(int timestampBits,
int workerIdBits,
int sequenceBits)
63 bits for timestampBits, workerIdBits, sequenceBitspublic long allocate(long deltaSeconds,
long workerId,
long sequence)
deltaSeconds - workerId - sequence - public int getSignBits()
public int getTimestampBits()
public int getWorkerIdBits()
public int getSequenceBits()
public long getMaxDeltaSeconds()
public long getMaxWorkerId()
public long getMaxSequence()
public int getTimestampShift()
public int getWorkerIdShift()
public java.lang.String toString()
toString 在类中 java.lang.Object