Hazelcast IdGenerator creates cluster-wide unique IDs. Generated IDs are long type primitive values between 0
and
Long.MAX_VALUE
. Id generation occurs almost at the speed of
AtomicLong.incrementAndGet()
. Generated IDs are unique during the life cycle of the cluster. If the entire cluster is restarted, IDs start
from 0 again.
import com.hazelcast.core.IdGenerator; import com.hazelcast.core.Hazelcast; IdGenerator idGenerator = Hazelcast.getIdGenerator("customer-ids"); long id = idGenerator.newId();