public interface Transaction
Modifier and Type | Field and Description |
---|---|
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 |
---|---|
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.
|
boolean |
getBoolean(String key)
Returns
true if and only if the corresponding property exists
and is equal to the string "true" . |
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.
|
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.
|
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 String[] PhaseInfo
static final int Kb
static final int Mb
void init(String path) throws IOException
path
- IOException
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"
.name
- the property name.boolean
value of the property.int getPhase()
String getPhaseInfo()
void begin() throws IOException
IOException
String[] getList(String prefix)
prefix
- boolean isPersistent()
void create(Serializable obj, String name) throws IOException
obj
- the object to store.name
- the name of the object.IOException
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
void save(Serializable obj, String name) throws IOException
obj
- the object to store.name
- the name of the object.IOException
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
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
void createByteArray(byte[] buf, String name) throws IOException
buf
- the byte array to store.name
- the name of the object.IOException
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
void saveByteArray(byte[] buf, String name) throws IOException
buf
- the byte array to store.name
- the name of the object.IOException
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
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
Object load(String name) throws IOException, ClassNotFoundException
name
- the name of the object.IOException
ClassNotFoundException
Object load(String dirName, String name) throws IOException, ClassNotFoundException
dirName
- the directory name of the object.name
- the name of the object.IOException
ClassNotFoundException
byte[] loadByteArray(String name) throws IOException, ClassNotFoundException
name
- the name of the object.IOException
ClassNotFoundException
byte[] loadByteArray(String dirName, String name) throws IOException
dirName
- the directory name of the object.name
- the name of the object.IOException
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
void release() throws IOException
IOException
void stop()
void close()
boolean containsOperations()
int getOperationCount()
Copyright © 2018 ScalAgent D.T.. All Rights Reserved.