public class FlakeIdGeneratorProxy extends AbstractDistributedObject<FlakeIdGeneratorService> implements FlakeIdGenerator
Modifier and Type | Class and Description |
---|---|
static class |
FlakeIdGeneratorProxy.IdBatchAndWaitTime |
Modifier and Type | Field and Description |
---|---|
static int |
BITS_NODE_ID |
static int |
BITS_SEQUENCE |
static int |
BITS_TIMESTAMP |
static long |
INCREMENT
The difference between two IDs from a sequence on single member
|
PARTITIONING_STRATEGY
Modifier and Type | Method and Description |
---|---|
String |
getName()
Returns the unique name for this DistributedObject.
|
String |
getServiceName()
Returns the service name for this object.
|
long |
newId()
Generates and returns a cluster-wide unique ID.
|
FlakeIdGeneratorProxy.IdBatchAndWaitTime |
newIdBatch(int batchSize) |
destroy, equals, getDistributedObjectName, getNameAsPartitionAwareData, getNodeEngine, getOperationService, getPartitionId, getPartitionKey, getService, hashCode, invalidate, invokeOnPartition, isClusterVersionEqualTo, isClusterVersionGreaterOrEqual, isClusterVersionGreaterThan, isClusterVersionLessOrEqual, isClusterVersionLessThan, isClusterVersionUnknown, isClusterVersionUnknownOrGreaterOrEqual, isClusterVersionUnknownOrGreaterThan, isClusterVersionUnknownOrLessOrEqual, isClusterVersionUnknownOrLessThan, postDestroy, preDestroy, throwNotActiveException, toData, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getPartitionKey
public static final int BITS_TIMESTAMP
public static final int BITS_SEQUENCE
public static final int BITS_NODE_ID
public static final long INCREMENT
public long newId()
FlakeIdGenerator
Operation on member is always local, if the member has valid node ID, otherwise it's remote. On
client, this method goes to a random member and gets a batch of IDs, which will then be returned
locally for limited time. The pre-fetch size and the validity time can be configured for
each client and member, see here
for member config and see ClientConfig.addFlakeIdGeneratorConfig()
for client config.
Note: Values returned from this method may be not strictly ordered.
newId
in interface FlakeIdGenerator
public FlakeIdGeneratorProxy.IdBatchAndWaitTime newIdBatch(int batchSize)
public String getName()
DistributedObject
DistributedObjectUtil.getName(DistributedObject)
because this might be also a PrefixedDistributedObject
.getName
in interface DistributedObject
public String getServiceName()
DistributedObject
getServiceName
in interface DistributedObject
getServiceName
in class AbstractDistributedObject<FlakeIdGeneratorService>
Copyright © 2019 Hazelcast, Inc.. All rights reserved.