com.hazelcast.concurrent.idgen
Class IdGeneratorProxy
java.lang.Object
com.hazelcast.spi.AbstractDistributedObject<IdGeneratorService>
com.hazelcast.concurrent.idgen.IdGeneratorProxy
- All Implemented Interfaces:
- DistributedObject, IdGenerator
public class IdGeneratorProxy
- extends AbstractDistributedObject<IdGeneratorService>
- implements IdGenerator
Method Summary |
String |
getName()
Returns the unique name for this DistributedObject. |
String |
getServiceName()
Returns the service name for this object. |
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 |
postDestroy()
|
Methods inherited from class com.hazelcast.spi.AbstractDistributedObject |
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getPartitionKey, getService, hashCode, invalidate, throwNotActiveException, toString |
BLOCK_SIZE
public static final int BLOCK_SIZE
- See Also:
- Constant Field Values
IdGeneratorProxy
public IdGeneratorProxy(IAtomicLong blockGenerator,
String name,
NodeEngine nodeEngine,
IdGeneratorService service)
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
getName
public String getName()
- Description copied from interface:
DistributedObject
- Returns the unique name for this DistributedObject. The returned value will never be null.
- Specified by:
getName
in interface DistributedObject
- Returns:
- the unique name for this object.
getServiceName
public String getServiceName()
- Description copied from interface:
DistributedObject
- Returns the service name for this object.
- Specified by:
getServiceName
in interface DistributedObject
- Specified by:
getServiceName
in class AbstractDistributedObject<IdGeneratorService>
- Returns:
- the service name for this object.
postDestroy
protected void postDestroy()
- Overrides:
postDestroy
in class AbstractDistributedObject<IdGeneratorService>
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.