public interface Transaction
Modifier and Type | Field and Description |
---|---|
static int |
BACKUP |
static int |
COMMIT |
static int |
FINALIZE |
static int |
FREE |
static int |
GARBAGE |
static int |
INIT |
static int |
Kb |
static int |
Mb |
static String[] |
PhaseInfo |
static int |
ROLLBACK |
static int |
RUN |
Modifier and Type | Method and Description |
---|---|
String |
backup(String path)
Backups the content of Transaction module.
|
void |
begin()
Start a transaction validation, the validation phase needs 3 phases: begin, commit
and release.
|
void |
close()
Close the transaction module.
|
void |
commit(boolean release)
Commit the current transaction.
|
boolean |
containsOperations()
Indicates whether some operations have been done in this transaction.
|
void |
create(Serializable obj,
String name)
Register the state of a newly created object in the current transaction.
|
void |
create(Serializable obj,
String dirName,
String name)
Register the state of a newly created object in the current transaction.
|
void |
createByteArray(byte[] buf,
String name)
Register a new byte array in the current transaction.
|
void |
createByteArray(byte[] buf,
String dirName,
String name)
Register a new byte array in the current transaction.
|
void |
delete(String name)
Deletes the specified object.
|
void |
delete(String dirName,
String name)
Deletes the specified object.
|
void |
freeze(long timeout) |
boolean |
getBoolean(String key)
Returns
true if and only if the corresponding property exists
and is equal to the string "true" . |
int |
getCommitCount()
Returns the number of commit operation since startup.
|
Integer |
getInteger(String key)
Determines the integer value of the property with the specified name.
|
Integer |
getInteger(String key,
int value)
Determines the integer value of the property with the specified name.
|
String[] |
getList(String prefix)
Returns an array of strings naming the objects in the component started by this prefix.
|
int |
getOperationCount()
Returns the number of operations to be committed.
|
int |
getPhase()
Returns the transaction state.
|
String |
getPhaseInfo()
Returns a string representation of the transaction state.
|
String |
getProperty(String key)
Searches for the property with the specified key in the specific Transaction
property list.
|
String |
getProperty(String key,
String defaultValue)
Searches for the property with the specified key in the specific Transaction
property list.
|
void |
init(String path)
Initializes the atomic storage component.
|
boolean |
isPersistent()
Returns true if the component is persistent.
|
Object |
load(String name)
Load the specified object.
|
Object |
load(String dirName,
String name)
Load the specified object.
|
void |
loadAll(String prefix,
Map map)
Fills the map with all objects of the component whose name begins with the prefix.
|
byte[] |
loadByteArray(String name)
Load the specified byte array.
|
byte[] |
loadByteArray(String dirName,
String name)
Load the specified byte array.
|
void |
release()
Release the mutual exclusion.
|
void |
save(Serializable obj,
String name)
Register the modified state of an object in the current transaction.
|
void |
save(Serializable obj,
String dirName,
String name)
Register the modified state of an object in the current transaction.
|
void |
save(Serializable obj,
String dirName,
String name,
boolean first)
Register the state of an object in the current transaction.
|
void |
saveByteArray(byte[] buf,
String name)
Register a modified byte array in the current transaction.
|
void |
saveByteArray(byte[] buf,
String dirName,
String name)
Register a modified byte array in the current transaction.
|
void |
saveByteArray(byte[] buf,
String dirName,
String name,
boolean copy,
boolean first)
Register a modified byte array in the current transaction.
|
void |
stop()
Stops the transaction module.
|
boolean |
useLoadAll()
Returns true if this Transaction implementation implements an optimized loadAll method.
|
static final int INIT
static final int FREE
static final int RUN
static final int COMMIT
static final int ROLLBACK
static final int GARBAGE
static final int FINALIZE
static final int BACKUP
static final String[] PhaseInfo
static final int Kb
static final int Mb
void init(String path) throws IOException
path
- the path of storage directory.IOException
- an error occurs.String getProperty(String key)
null
if the property is not found.key
- the property key.String getProperty(String key, String defaultValue)
key
- the property key.defaultValue
- a default value.Integer getInteger(String key)
key
- property name.Integer getInteger(String key, int value)
key
- property name.value
- a default value.boolean getBoolean(String key)
true
if and only if the corresponding property exists
and is equal to the string "true"
.key
- the property name.boolean
value of the property.int getPhase()
String getPhaseInfo()
int getCommitCount()
void begin() throws IOException
IOException
- an error occurs.String[] getList(String prefix)
prefix
- the prefix of searched objects.boolean useLoadAll()
void loadAll(String prefix, Map map)
prefix
- The prefix of searched objects.map
- The map of corresponding objects.boolean isPersistent()
void create(Serializable obj, String name) throws IOException
obj
- the object to store.name
- the name of the object.IOException
- an error occurs.void create(Serializable obj, String dirName, String name) throws IOException
obj
- the object to store.dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.void save(Serializable obj, String name) throws IOException
obj
- the object to store.name
- the name of the object.IOException
- an error occurs.void save(Serializable obj, String dirName, String name) throws IOException
obj
- the object to store.dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.void save(Serializable obj, String dirName, String name, boolean first) throws IOException
obj
- the object to store.dirName
- the directory name of the object.name
- the name of the object.first
- the object is a new one.IOException
- an error occurs.void createByteArray(byte[] buf, String name) throws IOException
buf
- the byte array to store.name
- the name of the object.IOException
- an error occurs.void createByteArray(byte[] buf, String dirName, String name) throws IOException
buf
- the byte array to store.dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.void saveByteArray(byte[] buf, String name) throws IOException
buf
- the byte array to store.name
- the name of the object.IOException
- an error occurs.void saveByteArray(byte[] buf, String dirName, String name) throws IOException
buf
- the byte array to store.dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.void saveByteArray(byte[] buf, String dirName, String name, boolean copy, boolean first) throws IOException
buf
- the byte array to store.dirName
- the directory name of the object.name
- the name of the object.copy
- the byte array can be modified, copy it.first
- the object is a new one.IOException
- an error occurs.Object load(String name) throws IOException, ClassNotFoundException
name
- the name of the object.IOException
- an error occurs.ClassNotFoundException
- an error occurs.Object load(String dirName, String name) throws IOException, ClassNotFoundException
dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.ClassNotFoundException
- an error occurs.byte[] loadByteArray(String name) throws IOException, ClassNotFoundException
name
- the name of the object.IOException
- an error occurs.ClassNotFoundException
- an error occurs.byte[] loadByteArray(String dirName, String name) throws IOException
dirName
- the directory name of the object.name
- the name of the object.IOException
- an error occurs.void delete(String name)
name
- the name of the object.void delete(String dirName, String name)
dirName
- the directory name of the object.name
- the name of the object.void commit(boolean release) throws IOException
release
- if true releases the transaction at the end of the commit.IOException
- an error occurs.void release() throws IOException
IOException
- an error occurs.void stop()
void close()
boolean containsOperations()
int getOperationCount()
String backup(String path) throws Exception
path
- Directory path to store the backup.Exception
- An error occurs during backup.void freeze(long timeout) throws InterruptedException
InterruptedException
Copyright © 2021 ScalAgent D.T.. All rights reserved.