Object
This class implements the Singleton design pattern for obtaining database sequencers. A single instance of a Sequencer exists to create sequence numbers. The sequence numbers are backed by a database, but blocks of sequence numbers are cached in the Sequencer instance.
This factory creates and maintains Sequencer instances so that multiple calls to one of the createSequencer methods with the same arguments will return the same reusable instance.
Related Topics
Object
SequencerFactory
Method Summary |
public static |
|
public static |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public staticReturns the singleton Sequencer for the given sequence name backed by the sequencer's default data source. A Sequencer is created if needed, but if one has already been created then that instance is returned.Sequencer
createSequencer(String
sequenceName)
The sequencer expects a DataSource named "weblogic.jdbc.jts.SequencerPool" which must be associated with a non-XA connection pool.
The default cache size for this sequencer is 2000. So the Sequencer will only need to access the database every 2000 calls to getNext().
Note that if a new sequencer is created for the first time, it will not interact with the database until the first call to getNext() on the returned Sequencer. Therefore, if you have an invalid DataSource object or the sequenceName is not a valid key for the database (i.e. is too long or contains characters the database can't handle), then you may see SQLExceptions on the first call to getNext().
public staticReturns the singleton Sequencer for the given sequence name and the given cache size. A Sequencer is created if needed, but if one has already been created then that instance is returned.Sequencer
createSequencer(String
sequenceName, long cacheSize)
Related Topics
SequencerFactory.createSequencer(String)