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 class
JPAUIDSequencerImpl.SeqRunner
-
Field Summary
Fields Modifier and Type Field Description static long
KEEP_ALIVE_TIME
static int
MAX_POOL_SIZE
static int
POOL_SIZE
static int
QUEUE_SIZE
protected ThreadPoolExecutor
tpe
-
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 void
activatePersistenceProvider()
void
dispose()
Must be called when the service is no longer neededprotected int
doGetNext(String key)
protected int
getNext(javax.persistence.EntityManager em, String key)
long
getNextLong(String key)
ExtendsUIDSequencer.getNext(java.lang.String)
to return a long value.protected PersistenceProvider
getOrCreatePersistenceProvider()
void
init()
Init Sequencervoid
initSequence(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:UIDSequencer
Init 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:UIDSequencer
Initializes 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:
initSequence
in interfaceUIDSequencer
- Overrides:
initSequence
in classAbstractUIDSequencer
-
getNextLong
public long getNextLong(String key)
Description copied from interface:UIDSequencer
ExtendsUIDSequencer.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)
-
-