public class ClientIdGeneratorProxy extends ClientProxy implements IdGenerator
IdGenerator
.name
Constructor and Description |
---|
ClientIdGeneratorProxy(String serviceName,
String objectId,
ClientContext context,
IAtomicLong blockGenerator) |
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.
|
protected void |
onDestroy()
Called before proxy is destroyed.
|
String |
toString() |
deregisterListener, destroy, equals, getClient, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onInitialize, onShutdown, postDestroy, preDestroy, registerListener, setContext, toData, toObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getName, getPartitionKey, getServiceName
public ClientIdGeneratorProxy(String serviceName, String objectId, ClientContext context, IAtomicLong blockGenerator)
public boolean init(long id)
IdGenerator
The first generated ID will be 1 greater than ID.
init
in interface IdGenerator
true
if initialization succeeded, false
if ID is less than 0.public long newId()
IdGenerator
Generated IDs are guaranteed to be unique for the entire cluster as long as the cluster is live. If the cluster restarts, then ID generation will start from 0.
newId
in interface IdGenerator
protected void onDestroy()
ClientProxy
onDestroy
in class ClientProxy
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.