|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.beasys.commerce.util.JDBCSequencer
com.bea.p13n.util.jdbc.Sequencer
and com.bea.p13n.util.jdbc.SequencerFactory
@Deprecated public class JDBCSequencer
The JDBCSequencer class is a portable implementation for generating unique sequence numbers. JDBCSequencer uses a caching strategy where a block of sequence numbers is allocated in memory. When the block of sequence numbers is exhausted, JDBCSequencer obtains a new range of sequence numbers from the database. This approach has the advantage of minimizing the database access but it can create sequence numbers to be skipped if the server is restarted.
This implementation uses the WLCS_SEQUENCER table to maintain the current values of the different sequences. Each sequence is represented by a row in the WLCS_SEQUENCER and a row is automatically inserted for a sequence that does not exists already.
When allocating a new block of sequence numbers, JDBCSequencer uses a retry loop for obtaining an application lock (IS_LOCKED column in WLCS_SEQUENCER) before incrementing the current value of a sequence. Two properties can be defined in the weblogiccommerce.properties file to control the number of retries and the datasource name to use for obtaining a database connection:
commerce.jdbcSequencer.maxRetry
default value is 5 (1 second wait each retry)
commerce.jdbcSequencer.dataSource.name
default value is "weblogic.jdbc.jts.commercePool"
Sequencer
,
SequencerFactory
Field Summary | |
---|---|
static long |
DEFAULT_CACHE_SIZE
Deprecated |
static String |
DEFAULT_SEQUENCE_NAME
Deprecated |
static String |
DEFAULT_SEQUENCER_DATASOURCE_NAME
Deprecated |
static String |
DEFAULT_SEQUENCER_NAME
Deprecated |
static long |
DEFAULT_STEP_SIZE
Deprecated |
static String |
SEQUENCE_LOCK_IDENTIFIER
Deprecated |
static String |
SEQUENCE_NAME_IDENTIFIER
Deprecated |
static String |
SEQUENCE_VALUE_IDENTIFIER
Deprecated |
static String |
SEQUENCER_DATASOURCE_NAME_PROPERTY
Deprecated |
static String |
SEQUENCER_MAX_RETRY_PROPERTY
Deprecated |
Constructor Summary | |
---|---|
JDBCSequencer()
Deprecated Default constructor. |
|
JDBCSequencer(String sequencerName,
String sequenceName)
Deprecated Creates a new JDBCSequencer with the supplied sequencer name
and managed sequence name. |
|
JDBCSequencer(String sequencerName,
String sequenceName,
long cacheSize)
Deprecated Creates a new JDBCSequencer with the supplied sequencer name,
managed sequence name, and cache size. |
|
JDBCSequencer(String sequencerName,
String sequenceName,
long cacheSize,
long stepSize)
Deprecated Creates a new JDBCSequencer with the supplied sequencer name,
managed sequence name, cache size, and step size. |
Method Summary | |
---|---|
protected void |
allocateSequenceBlock()
Deprecated Allocates a new block of sequence numbers from the database. |
protected void |
cleanUpResources()
Deprecated Closes any open DB resources. |
long |
getCacheSize()
Deprecated Returns the cache size. |
long |
getCurrent()
Deprecated Gets the current sequence number associated with this sequencer. |
long |
getCurrent(Connection databaseConnection)
Deprecated JDBCSequencer must allocate the sequence block using a separate transaction because the database updates can be undone if a rollback occurs on the passed connection. Replaced by getNext() |
long |
getIncrementAmount()
Deprecated Replaced by getCacheSize |
long |
getNext()
Deprecated Gets the next sequence number. |
long |
getNext(Connection databaseConnection)
Deprecated JDBCSequencer must allocate the sequence block using a separate transaction because the database updates can be undone if a rollback occurs on the passed connection. Replaced by getNext() |
String |
getSequenceName()
Deprecated Returns the name of the sequence that is managed by this sequencer. |
String |
getSequencerName()
Deprecated Returns the name of this sequencer. |
long |
getStepSize()
Deprecated Returns the step size. |
void |
setCacheSize(long cacheSize)
Deprecated Sets the cache size. |
void |
setIncrementAmount(long incrementAmount)
Deprecated Replaced by setCacheSize |
void |
setSequenceName(String sequenceName)
Deprecated Sets the name of the sequence that is managed by this sequencer. |
void |
setSequencerName(String sequencerName)
Deprecated Sets the name of this sequencer. |
void |
setStepSize(long stepSize)
Deprecated Sets the step size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_CACHE_SIZE
public static final long DEFAULT_STEP_SIZE
public static final String SEQUENCER_DATASOURCE_NAME_PROPERTY
public static final String SEQUENCER_MAX_RETRY_PROPERTY
public static final String DEFAULT_SEQUENCER_DATASOURCE_NAME
public static final String DEFAULT_SEQUENCER_NAME
public static final String DEFAULT_SEQUENCE_NAME
public static final String SEQUENCE_NAME_IDENTIFIER
public static final String SEQUENCE_VALUE_IDENTIFIER
public static final String SEQUENCE_LOCK_IDENTIFIER
Constructor Detail |
---|
public JDBCSequencer()
public JDBCSequencer(String sequencerName, String sequenceName)
JDBCSequencer
with the supplied sequencer name
and managed sequence name.
sequencerName
- The name of the new sequencer.sequenceName
- The name of the managed sequence.public JDBCSequencer(String sequencerName, String sequenceName, long cacheSize)
JDBCSequencer
with the supplied sequencer name,
managed sequence name, and cache size.
sequencerName
- The name of the new sequencer.sequenceName
- The name of the managed sequence.cacheSize
- The cache size.public JDBCSequencer(String sequencerName, String sequenceName, long cacheSize, long stepSize)
JDBCSequencer
with the supplied sequencer name,
managed sequence name, cache size, and step size.
sequencerName
- The name of the new sequencer.sequenceName
- The name of the managed sequence.cacheSize
- The cache size.Method Detail |
---|
public long getNext(Connection databaseConnection) throws SQLException
getNext()
getNext
in interface Sequencer
databaseConnection
- The database connection used to
generate the next sequence number.
SQLException
- on error.
SQLException
public long getNext() throws SQLException
SQLException
- on error.
SQLException
public long getCurrent(Connection databaseConnection) throws SQLException
getNext()
getCurrent
in interface Sequencer
databaseConnection
- The database connection used to
generate the next sequence number.
SQLException
- on error.
SQLException
public long getCurrent() throws SQLException
SQLException
- on error.
SQLException
protected final void allocateSequenceBlock() throws SQLException
SQLException
- on error.
SQLException
protected final void cleanUpResources()
public long getIncrementAmount()
getIncrementAmount
in interface Sequencer
getCacheSize()
public void setIncrementAmount(long incrementAmount)
setIncrementAmount
in interface Sequencer
incrementAmount
- The increment amount.setCacheSize(long)
public long getCacheSize()
getCacheSize
in interface Sequencer
public void setCacheSize(long cacheSize)
setCacheSize
in interface Sequencer
cacheSize
- The cache size.public long getStepSize()
getNext()
.
getStepSize
in interface Sequencer
public void setStepSize(long stepSize)
getNext()
.
setStepSize
in interface Sequencer
stepSize
- The step size.public String getSequencerName()
getSequencerName
in interface Sequencer
public void setSequencerName(String sequencerName)
setSequencerName
in interface Sequencer
sequencerName
- The new sequencer name.public String getSequenceName()
getSequenceName
in interface Sequencer
public void setSequenceName(String sequenceName)
setSequenceName
in interface Sequencer
sequenceName
- The new sequence name.
|
Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |