public class SimpleUniqueIdGenerator extends Object implements UniqueIDGeneratorService
Modifier and Type | Field and Description |
---|---|
static AtomicLong |
ID |
Constructor and Description |
---|
SimpleUniqueIdGenerator() |
Modifier and Type | Method and Description |
---|---|
Object |
generate()
Returns a unique id across the network, including those generated by
UniqueIDGeneratorService.generateFor(Class) method. |
Object |
generateFor(Class klass)
Returns a unique id across the network, including those generated by
UniqueIDGeneratorService.generate() method. |
public static final AtomicLong ID
public Object generate()
UniqueIDGeneratorService
UniqueIDGeneratorService.generateFor(Class)
method. For e.g. if generateFor has already
generated id "1", this method will not return "1" anymore. For a single
JVM server, this method would just send back an Atomically incremented
counter.generate
in interface UniqueIDGeneratorService
public Object generateFor(Class klass)
UniqueIDGeneratorService
UniqueIDGeneratorService.generate()
method. For e.g. if generate has already generated id
"1", this method will not return "1" anymore. For a single JVM server,
this method would just send back an Atomically incremented counter.generateFor
in interface UniqueIDGeneratorService
klass
- The class for which this method is being generated. The
generator implementation can then probably put in a suffix of
identification for generated id's.Copyright © 2013. All Rights Reserved.