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()
UniqueIDGeneratorServiceUniqueIDGeneratorService.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 UniqueIDGeneratorServicepublic Object generateFor(Class klass)
UniqueIDGeneratorServiceUniqueIDGeneratorService.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 UniqueIDGeneratorServiceklass - 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.