Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2008 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.util.jdbc
Class SequencerFactory

    java.lang.Object
      com.bea.p13n.util.jdbc.SequencerFactory

    public final class SequencerFactory

extends 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.

See Also
  `Sequencer`

Method Summary
`static Sequencer` | `createSequencer(String sequenceName)` Returns the singleton Sequencer for the given sequence name backed by the sequencer's default data source.
`static Sequencer` | `createSequencer(String sequenceName, long cacheSize)` Returns the singleton Sequencer for the given sequence name and the given cache size.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### createSequencer

    public static Sequencer createSequencer(String sequenceName)

  Returns 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.

  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().

  Parameters
    `sequenceName` - The name of the managed sequence. This name is used as the primary key (row name) in the database. The sequence name may not be null or an empty string.
  Returns
    singleton named Sequencer

### createSequencer

    public static Sequencer createSequencer(String sequenceName,
                                            long cacheSize)

  Returns 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.

  Parameters
    `sequenceName` - The name of the managed sequence. This name is used as the primary key (row name) in the database. The sequence name may not be null or an empty string.
    `cacheSize` - The cache size. The cache is the size of the block that a sequencer instance keeps in memory. The larger the cache, the less often the sequencer must go to the database. If this parameter is zero, the default cache size (2000) is used. The cache size may not be less than zero.
  Returns
    singleton named Sequencer with the given cacheSize
  See Also
    `createSequencer(java.lang.String)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 BEA Systems, Inc. All Rights Reserved