public class ClientFlakeIdGeneratorProxy extends ClientProxy implements FlakeIdGenerator
IdGenerator
.name
Constructor and Description |
---|
ClientFlakeIdGeneratorProxy(String serviceName,
String objectName,
ClientContext context) |
Modifier and Type | Method and Description |
---|---|
boolean |
init(long id)
Tries to initialize this
IdGenerator instance with the given ID. |
long |
newId()
Generates and returns a cluster-wide unique ID.
|
String |
toString() |
deregisterListener, destroy, destroyLocally, destroyRemotely, equals, getClient, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onInitialize, onShutdown, postDestroy, preDestroy, registerListener, setContext, toData, toObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getName, getPartitionKey, getServiceName
public ClientFlakeIdGeneratorProxy(String serviceName, String objectName, ClientContext context)
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 IdGenerator
newId
in interface FlakeIdGenerator
public boolean init(long id)
FlakeIdGenerator
IdGenerator
instance with the given ID.
The next generated ID will be 1 greater than the supplied ID.
Note for Flake ID Generator: This method does nothing and will simply tell if the next ID will be larger than the given ID. You don't need to call this method on cluster restart - uniqueness is preserved thanks to the timestamp component of the ID.
init
in interface IdGenerator
init
in interface FlakeIdGenerator
true
, if the next ID will be larger than the supplied idCopyright © 2018 Hazelcast, Inc.. All Rights Reserved.