Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.persistence.db
Class PooledOracleUidGenerator
All Implemented Interfaces:
       UniqueIdGenerator

public class PooledOracleUidGenerator      
Thread-safe, pooling oracle uid generator.
Uses a mixed sequence/cache mechanism, mapping
sequences to a backing cache of integers
that synchronize at a rate prescribed by the
db sequence increment.


Changing the sequence increment during the lifecycle
of this generator will have adverse effects to the generation
of unique keys.




It is recommended that you only use
a single PooledOracleUidGenerator for the lifetime
of the application.

Initialization is generally the most expensive process.
Secondly the backing cache is not shared by different
pooled instances, therefore gaps may appear for an
application that is retrieving from the same logical
sequence, the actual database sequence, mapped by
the uidName in the method getNextUniqueId and
getCurrentUniqueId.

TODO: possibly improve concurrency access.
Author:
msimonsen
Implements:
UniqueIdGenerator
 
Links:
Implementation Implementation Link
to Interface UniqueIdGenerator
Thread-safe, pooling oracle uid generator.
Uses a mixed sequence/cache mechanism, mapping
sequences to a backing cache of integers
that synchronize at a rate prescribed by the
db sequence increment.


Changing the sequence increment during the lifecycle
of this generator will have adverse effects to the generation
of unique keys.




It is recommended that you only use
a single PooledOracleUidGenerator for the lifetime
of the application.

Initialization is generally the most expensive process.
Secondly the backing cache is not shared by different
pooled instances, therefore gaps may appear for an
application that is retrieving from the same logical
sequence, the actual database sequence, mapped by
the uidName in the method getNextUniqueId and
getCurrentUniqueId.

TODO: possibly improve concurrency access.
Author:
msimonsen
 
 

Field Summary
private ReentrantLock
private HashMap
Constructor Summary
public void
Method Summary
public int
getCurrentUniqueId(String uidName, Transaction transaction)
public int
getNextUniqueId(String uidName, Transaction transaction)
Field Detail
lock
private ReentrantLock lock
Multiplicity:
1
 

pooledGenerator
private HashMap pooledGenerator
Multiplicity:
1
 
Constructor Detail
PooledOracleUidGenerator
public void PooledOracleUidGenerator ()
 
Stereotype:
create
 
Method Detail
getCurrentUniqueId
public int getCurrentUniqueId (String uidName, Transaction transaction)
 
Throws:
PersistenceException
 

getNextUniqueId
public int getNextUniqueId (String uidName, Transaction transaction)
 
Throws:
PersistenceException
 

Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD