com.hazelcast.core
Interface IdGenerator

All Superinterfaces:
DistributedObject

public interface IdGenerator
extends DistributedObject

Cluster-wide unique id generator.


Method Summary
 boolean init(long id)
          Try to initialize this IdGenerator instance with given id.
 long newId()
          Generates and returns cluster-wide unique id.
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getName, getPartitionKey, getServiceName
 

Method Detail

init

boolean init(long id)
Try to initialize this IdGenerator instance with given id. The first generated id will be 1 bigger than id.

Returns:
true if initialization success. If id is equal or smaller than 0, then false is returned.

newId

long newId()
Generates and returns 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.

Returns:
cluster-wide new unique id


Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.