public class H2SequenceHandler extends SequenceHandler
Modifier and Type | Field and Description |
---|---|
private static java.util.logging.Logger |
LOG
J2SE Logger.
|
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> |
sequences
The list of sequences grouped by databases.
|
Constructor and Description |
---|
H2SequenceHandler(java.lang.String ldbName)
The only constructor takes the name of the database as argument.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
safeContains(java.lang.String seqName,
java.lang.String ldbName)
Test whether the database contains a sequence.
|
protected int64 |
safeGetCurrentValue(java.lang.String seqName,
java.lang.String ldbName)
Queries the current value of a sequence.
|
protected int64 |
safeGetNextValue(java.lang.String seqName,
java.lang.String ldbName)
Computes and returns the next value of a sequence.
|
protected void |
safeSetValue(java.lang.String seqName,
java.lang.String ldbName,
long newVal)
Initialize (reset) the current value of a sequence.
|
contains, getCurrentValue, getNextValue, getResultValue, setValue
private static final java.util.logging.Logger LOG
private java.util.HashMap<java.lang.String,java.util.LinkedList<java.lang.String>> sequences
public H2SequenceHandler(java.lang.String ldbName)
ldbName
- The database logical name on which this handler will work with.protected int64 safeGetCurrentValue(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeGetCurrentValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. It is assumed it is not null and
valid.protected int64 safeGetNextValue(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeGetNextValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. It is assumed it is not null and
valid.protected void safeSetValue(java.lang.String seqName, java.lang.String ldbName, long newVal)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeSetValue
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. It is assumed it is not null and
valid.newVal
- The value the sequence will be reset to.protected boolean safeContains(java.lang.String seqName, java.lang.String ldbName)
This method should be called only in a safe environment, where the database-level lock for access to sequences has already been acquired.
safeContains
in class SequenceHandler
seqName
- The name of the sequence.ldbName
- The database to which the sequence belongs to. If is null then the first connected
database is assumed.