@Beta public class UncertaintyIdGenerator extends java.lang.Object implements IdGeneratorDecorator
1. The problem of uneven sharding of snowflake IDs.
2. I don’t want the generated ID to be predictable, such as preventing crawler by ID number, predicting transaction volume.
| Modifier and Type | Field and Description |
|---|---|
protected IdGenerator |
actual |
| Constructor and Description |
|---|
UncertaintyIdGenerator(IdGenerator actual,
int uncertaintyBits) |
| Modifier and Type | Method and Description |
|---|---|
long |
generate()
Generate distributed ID.
|
IdGenerator |
getActual()
Get decorator actual id generator.
|
long |
maxOriginalId() |
int |
originalIdBits() |
int |
uncertaintyBits() |
long |
uncertaintyBound() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActualgenerateAsString, idConverterprotected final IdGenerator actual
public UncertaintyIdGenerator(IdGenerator actual, int uncertaintyBits)
public int uncertaintyBits()
public int originalIdBits()
public long uncertaintyBound()
public long maxOriginalId()
public IdGenerator getActual()
IdGeneratorDecoratorgetActual in interface IdGeneratorDecoratorpublic long generate()
IdGeneratorgenerate in interface IdGeneratorgenerate in interface IdGeneratorDecorator