Package org.nuxeo.ecm.platform.uidgen
Class JPAUIDSequencerImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
-
- org.nuxeo.ecm.platform.uidgen.JPAUIDSequencerImpl
-
- All Implemented Interfaces:
UIDSequencer
public class JPAUIDSequencerImpl extends AbstractUIDSequencer
This implementation uses a static persistence provider to be able to instantiate this class without passing by Framework.getService -> this is to avoid potential problems do to sequencer factories. Anyway sequencer factories should be removed (I don't think they are really needed).- Author:
- Bogdan Stefanescu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJPAUIDSequencerImpl.SeqRunner
-
Field Summary
Fields Modifier and Type Field Description static longKEEP_ALIVE_TIMEstatic intMAX_POOL_SIZEstatic intPOOL_SIZEstatic intQUEUE_SIZEprotected ThreadPoolExecutortpe-
Fields inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
name
-
-
Constructor Summary
Constructors Constructor Description JPAUIDSequencerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidactivatePersistenceProvider()voiddispose()Must be called when the service is no longer neededprotected intdoGetNext(String key)protected intgetNext(javax.persistence.EntityManager em, String key)longgetNextLong(String key)ExtendsUIDSequencer.getNext(java.lang.String)to return a long value.protected PersistenceProvidergetOrCreatePersistenceProvider()voidinit()Init SequencervoidinitSequence(String key, long id)Initializes the sequencer with the given key to at least the given long id.-
Methods inherited from class org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
getName, getNext, initSequence, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.uidgen.UIDSequencer
getNextBlock
-
-
-
-
Field Detail
-
POOL_SIZE
public static final int POOL_SIZE
- See Also:
- Constant Field Values
-
MAX_POOL_SIZE
public static final int MAX_POOL_SIZE
- See Also:
- Constant Field Values
-
KEEP_ALIVE_TIME
public static final long KEEP_ALIVE_TIME
- See Also:
- Constant Field Values
-
QUEUE_SIZE
public static final int QUEUE_SIZE
- See Also:
- Constant Field Values
-
tpe
protected ThreadPoolExecutor tpe
-
-
Method Detail
-
init
public void init()
Description copied from interface:UIDSequencerInit Sequencer
-
dispose
public void dispose()
Must be called when the service is no longer needed
-
getOrCreatePersistenceProvider
protected PersistenceProvider getOrCreatePersistenceProvider()
-
activatePersistenceProvider
protected static void activatePersistenceProvider()
-
initSequence
public void initSequence(String key, long id)
Description copied from interface:UIDSequencerInitializes the sequencer with the given key to at least the given long id.A sequence can only be incremented, so if its current id is greater than the given id the sequence won't be decremented to reach the given id.
- Specified by:
initSequencein interfaceUIDSequencer- Overrides:
initSequencein classAbstractUIDSequencer
-
getNextLong
public long getNextLong(String key)
Description copied from interface:UIDSequencerExtendsUIDSequencer.getNext(java.lang.String)to return a long value. This method is compatible with getNext in the integer range.
-
doGetNext
protected int doGetNext(String key)
-
getNext
protected int getNext(javax.persistence.EntityManager em, String key)
-
-