public class IdGeneratorImpl extends Object implements IdGenerator
IAtomicLong
For each block, id generation is simply a volatile incrementModifier and Type | Field and Description |
---|---|
static int |
BLOCK_SIZE |
Constructor and Description |
---|
IdGeneratorImpl(IAtomicLong blockGenerator) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this object cluster-wide.
|
String |
getName()
Returns the unique name for this DistributedObject.
|
String |
getPartitionKey()
Returns the key of the partition that this DistributedObject is assigned to.
|
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.
|
public static final int BLOCK_SIZE
public IdGeneratorImpl(IAtomicLong blockGenerator)
public boolean init(long id)
IdGenerator
init
in interface IdGenerator
public long newId()
IdGenerator
newId
in interface IdGenerator
public String getPartitionKey()
DistributedObject
IAtomicLong
. For a partitioned data structure like an IMap
,
the returned value will not be null, but otherwise undefined.getPartitionKey
in interface DistributedObject
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
public void destroy()
DistributedObject
destroy
in interface DistributedObject
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.