|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.transaction.file.FileSequence
public class FileSequence
Fail-Safe sequence store implementation using the file system. Works by versioning values of sequences and throwing away all versions, but the current and the previous one.
Field Summary | |
---|---|
protected LoggerFacade |
logger
|
protected java.lang.String |
storeDir
|
Constructor Summary | |
---|---|
FileSequence(java.lang.String storeDir,
LoggerFacade logger)
Creates a new resouce manager operation on the specified directories. |
Method Summary | |
---|---|
boolean |
create(java.lang.String sequenceName,
long initialValue)
Creates a sequence if it does not already exist. |
boolean |
delete(java.lang.String sequenceName)
Deletes a sequence if it exists. |
boolean |
exists(java.lang.String sequenceName)
Checks if the sequence already exists. |
protected java.lang.String |
getPathI(java.lang.String sequenceName)
|
protected java.lang.String |
getPathII(java.lang.String sequenceName)
|
long |
nextSequenceValueBottom(java.lang.String sequenceName,
long increment)
Gets the next value of the sequence. |
protected long |
read(java.lang.String sequenceName)
|
protected long |
readFromPath(java.lang.String path)
|
protected void |
write(java.lang.String sequenceName,
long value)
|
protected void |
writeToPath(java.lang.String path,
long value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String storeDir
protected final LoggerFacade logger
Constructor Detail |
---|
public FileSequence(java.lang.String storeDir, LoggerFacade logger) throws ResourceManagerException
storeDir
- directory where sequence information is storedlogger
- logger used for warnings only
ResourceManagerException
Method Detail |
---|
public boolean exists(java.lang.String sequenceName)
sequenceName
- the name of the sequence you want to check
true
if the sequence already exists, false
otherwisepublic boolean create(java.lang.String sequenceName, long initialValue) throws ResourceManagerException
sequenceName
- the name of the sequence you want to create
true
if the sequence has been created, false
if it already existed
ResourceManagerException
- if anything goes wrong while accessing the sequencepublic boolean delete(java.lang.String sequenceName)
sequenceName
- the name of the sequence you want to delete
true
if the sequence has been deleted, false
if notpublic long nextSequenceValueBottom(java.lang.String sequenceName, long increment) throws ResourceManagerException
sequenceName
- the name of the sequence you want the next value forincrement
- the increment for the sequence, i.e. how much to add to the sequence with this call
ResourceManagerException
- if anything goes wrong while accessing the sequenceprotected long read(java.lang.String sequenceName) throws ResourceManagerException
ResourceManagerException
protected void write(java.lang.String sequenceName, long value) throws ResourceManagerException
ResourceManagerException
protected java.lang.String getPathI(java.lang.String sequenceName)
protected java.lang.String getPathII(java.lang.String sequenceName)
protected long readFromPath(java.lang.String path) throws ResourceManagerException, java.lang.NumberFormatException, java.io.FileNotFoundException, java.io.IOException
ResourceManagerException
java.lang.NumberFormatException
java.io.FileNotFoundException
java.io.IOException
protected void writeToPath(java.lang.String path, long value) throws ResourceManagerException
ResourceManagerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |