com.hazelcast.client.proxy
Class ClientIdGeneratorProxy
java.lang.Object
com.hazelcast.client.spi.ClientProxy
com.hazelcast.client.proxy.ClientIdGeneratorProxy
- All Implemented Interfaces:
- DistributedObject, IdGenerator
public class ClientIdGeneratorProxy
- extends ClientProxy
- implements IdGenerator
Method Summary |
boolean |
init(long id)
Try 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()
|
Methods inherited from class com.hazelcast.client.spi.ClientProxy |
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invoke, invokeInterruptibly, listen, listen, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject |
ClientIdGeneratorProxy
public ClientIdGeneratorProxy(String serviceName,
String objectId,
IAtomicLong atomicLong)
init
public boolean init(long id)
- Description copied from interface:
IdGenerator
- Try to initialize this IdGenerator instance with the given id. The first
generated id will be 1 greater than id.
- Specified by:
init
in interface IdGenerator
- Returns:
- true if initialization succeeded, false if id is less than 0.
newId
public long newId()
- Description copied from interface:
IdGenerator
- Generates and returns a cluster-wide unique id.
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.
- Specified by:
newId
in interface IdGenerator
- Returns:
- the cluster-wide new unique id
onDestroy
protected void onDestroy()
- Description copied from class:
ClientProxy
- Called before proxy is destroyed.
Overriding implementations should clean/release resources created during initialization.
- Overrides:
onDestroy
in class ClientProxy
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.