Class AUIDGenerator
- java.lang.Object
-
- org.datanucleus.store.valuegenerator.AbstractGenerator<String>
-
- org.datanucleus.store.valuegenerator.AUIDGenerator
-
- All Implemented Interfaces:
ValueGenerator<String>
public class AUIDGenerator extends AbstractGenerator<String>
This generator uses a Java implementation of DCE UUIDs to create unique identifiers without the overhead of additional database transactions or even an open database connection. The identifiers are Strings of the form "LLLLLLLL-MMMM-HHHH-CCCC-NNNNNNNNNNNN" where 'L', 'M', 'H', 'C' and 'N' are the DCE UUID fields named time low, time mid, time high, clock sequence and node.This generator can be used in concurrent applications. It is especially useful in situations where large numbers of transactions within a certain amount of time have to be made, and the additional overhead of synchronizing the concurrent creation of unique identifiers through the database would break performance limits.
Note: Due to limitations of the available Java API there is a chance of less than 1:2^62 that two concurrently running JVMs will produce the same identifiers, which is in practical terms never, because your database server will have crashed a million times before this happens.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.valuegenerator.AbstractGenerator
allocationSize, block, initialValue, name, storeMgr
-
Fields inherited from interface org.datanucleus.store.valuegenerator.ValueGenerator
PROPERTY_CATALOG_NAME, PROPERTY_CLASS_NAME, PROPERTY_COLUMN_NAME, PROPERTY_FIELD_NAME, PROPERTY_KEY_CACHE_SIZE, PROPERTY_KEY_DATABASE_CACHE_SIZE, PROPERTY_KEY_INITIAL_VALUE, PROPERTY_KEY_MAX_VALUE, PROPERTY_KEY_MIN_VALUE, PROPERTY_ROOT_CLASS_NAME, PROPERTY_SCHEMA_NAME, PROPERTY_SEQUENCE_NAME, PROPERTY_SEQUENCETABLE_CATALOG, PROPERTY_SEQUENCETABLE_NAME_COLUMN, PROPERTY_SEQUENCETABLE_NEXTVAL_COLUMN, PROPERTY_SEQUENCETABLE_SCHEMA, PROPERTY_SEQUENCETABLE_TABLE, PROPERTY_TABLE_NAME
-
-
Constructor Summary
Constructors Constructor Description AUIDGenerator(StoreManager storeMgr, String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Class
getStorageClass()
Accessor for the storage class for values generated with this generator.protected ValueGenerationBlock<String>
reserveBlock(long size)
Method to reserve "size" values to the block.-
Methods inherited from class org.datanucleus.store.valuegenerator.AbstractGenerator
allocate, current, currentValue, getName, next, nextValue, obtainGenerationBlock, obtainGenerationBlock, reserveBlock
-
-
-
-
Constructor Detail
-
AUIDGenerator
public AUIDGenerator(StoreManager storeMgr, String name)
-
-
Method Detail
-
getStorageClass
public static Class getStorageClass()
Accessor for the storage class for values generated with this generator.- Returns:
- Storage class (in this case String.class)
-
reserveBlock
protected ValueGenerationBlock<String> reserveBlock(long size)
Method to reserve "size" values to the block.- Specified by:
reserveBlock
in classAbstractGenerator<String>
- Parameters:
size
- The block size- Returns:
- The reserved block
-
-