Package fr.dyade.aaa.util
Class JTransaction
- java.lang.Object
-
- fr.dyade.aaa.util.BaseTransaction
-
- fr.dyade.aaa.util.JTransaction
-
- All Implemented Interfaces:
JTransactionMBean,Transaction,TransactionMBean
@Deprecated public final class JTransaction extends BaseTransaction implements JTransactionMBean
Deprecated.The JTransaction class implements a transactionnal storage. This implementation is simple but inefficient, its main advantage is the compatibility with old JDK.- See Also:
Transaction
-
-
Field Summary
Fields Modifier and Type Field Description private intcommitCountDeprecated.Number of commit operation since starting up.private FiledirDeprecated.static StringEMPTY_STRINGDeprecated.private HashtablelogDeprecated.private static StringLOGDeprecated.private RandomAccessFilelogFileDeprecated.(package private) static intLogThresholdOperationDeprecated.Number of pooled operation, by default 100.protected intphaseDeprecated.protected longstartTimeDeprecated.-
Fields inherited from class fr.dyade.aaa.util.BaseTransaction
DEBUG, logmon
-
-
Constructor Summary
Constructors Constructor Description JTransaction()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void_commit()Deprecated.Stringbackup(String path)Deprecated.Backups the content of Transaction module.voidbegin()Deprecated.Start a transaction validation, the validation phase needs 3 phases: begin, commit and release.voidclose()Deprecated.Close the transaction module.voidcommit(boolean release)Deprecated.Commit the current transaction.booleancontainsOperations()Deprecated.Indicates whether some operations have been done in this transaction.voidcreate(Serializable obj, String name)Deprecated.Register the state of a newly created object in the current transaction.voidcreate(Serializable obj, String dirName, String name)Deprecated.Register the state of a newly created object in the current transaction.voidcreateByteArray(byte[] buf, String name)Deprecated.Register a new byte array in the current transaction.voidcreateByteArray(byte[] buf, String dirName, String name)Deprecated.Register a new byte array in the current transaction.voiddelete(String name)Deprecated.Deletes the specified object.voiddelete(String dirName, String name)Deprecated.Deletes the specified object.private voiddeleteDir(File dir)Deprecated.Delete the specified directory if it is empty.intgetCommitCount()Deprecated.Returns the number of commit operation since starting up.FilegetDir()Deprecated.String[]getList(String prefix)Deprecated.Returns an array of strings naming the objects in the component started by this prefix.intgetOperationCount()Deprecated.Returns the number of operations to be committed.StringgetPersistenceDir()Deprecated.Returns the path of persistence directory.intgetPhase()Deprecated.Returns the transaction state.StringgetPhaseInfo()Deprecated.Returns a string representation of the transaction state.longgetStartTime()Deprecated.Returns the starting time.voidinit(String path)Deprecated.Initializes the atomic storage component.booleanisPersistent()Deprecated.Tests if the Transaction component is persistent.Objectload(String name)Deprecated.Load the specified object.Objectload(String dirName, String name)Deprecated.Load the specified object.voidloadAll(String prefix, Map map)Deprecated.Fills the map with all objects of the component whose name begins with the prefix.byte[]loadByteArray(String name)Deprecated.Load the specified byte array.byte[]loadByteArray(String dirName, String name)Deprecated.Load the specified byte array.voidrelease()Deprecated.Release the mutual exclusion.voidsave(Serializable obj, String name)Deprecated.Register the modified state of an object in the current transaction.voidsave(Serializable obj, String dirName, String name)Deprecated.Register the modified state of an object in the current transaction.voidsave(Serializable obj, String dirName, String name, boolean first)Deprecated.Register the state of an object in the current transaction.voidsaveByteArray(byte[] buf, String name)Deprecated.Register a modified byte array in the current transaction.voidsaveByteArray(byte[] buf, String dirName, String name)Deprecated.Register a modified byte array in the current transaction.voidsaveByteArray(byte[] buf, String dirName, String name, boolean copy, boolean first)Deprecated.Register a modified byte array in the current transaction.protected voidsetPhase(int newPhase)Deprecated.voidstop()Deprecated.Stops the transaction module.booleanuseLoadAll()Deprecated.Returns false, this Transaction implementation does not implement an optimized loadAll method.-
Methods inherited from class fr.dyade.aaa.util.BaseTransaction
dumpObjectList, freeze, getBoolean, getInteger, getInteger, getObject, getObjectList, getProperty, getProperty, loadProperties, saveProperties
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.dyade.aaa.util.TransactionMBean
dumpObjectList, getObject, getObjectList
-
-
-
-
Field Detail
-
startTime
protected long startTime
Deprecated.
-
commitCount
private int commitCount
Deprecated.Number of commit operation since starting up.
-
EMPTY_STRING
public static final String EMPTY_STRING
Deprecated.
-
LogThresholdOperation
static int LogThresholdOperation
Deprecated.Number of pooled operation, by default 100. This value can be adjusted for a particular server by settingLogThresholdOperationspecific property.These property can be fixed either from
javalaunching command, or ina3servers.xmlconfiguration file.
-
dir
private File dir
Deprecated.
-
LOG
private static final String LOG
Deprecated.- See Also:
- Constant Field Values
-
logFile
private RandomAccessFile logFile
Deprecated.
-
log
private Hashtable log
Deprecated.
-
phase
protected int phase
Deprecated.
-
-
Method Detail
-
getStartTime
public long getStartTime()
Deprecated.Returns the starting time.- Specified by:
getStartTimein interfaceTransactionMBean- Returns:
- The starting time.
-
getCommitCount
public final int getCommitCount()
Deprecated.Returns the number of commit operation since starting up.- Specified by:
getCommitCountin interfaceTransaction- Specified by:
getCommitCountin interfaceTransactionMBean- Returns:
- The number of commit operation.
-
isPersistent
public boolean isPersistent()
Deprecated.Tests if the Transaction component is persistent.- Specified by:
isPersistentin interfaceTransaction- Specified by:
isPersistentin interfaceTransactionMBean- Returns:
- true.
-
init
public void init(String path) throws IOException
Deprecated.Description copied from interface:TransactionInitializes the atomic storage component.- Specified by:
initin interfaceTransaction- Parameters:
path- the path of storage directory.- Throws:
IOException- an error occurs.
-
getDir
public File getDir()
Deprecated.
-
getPersistenceDir
public String getPersistenceDir()
Deprecated.Returns the path of persistence directory.- Returns:
- The path of persistence directory.
-
getPhase
public final int getPhase()
Deprecated.Description copied from interface:TransactionMBeanReturns the transaction state.- Specified by:
getPhasein interfaceTransaction- Specified by:
getPhasein interfaceTransactionMBean- Returns:
- the transaction state.
-
getPhaseInfo
public final String getPhaseInfo()
Deprecated.Description copied from interface:TransactionMBeanReturns a string representation of the transaction state.- Specified by:
getPhaseInfoin interfaceTransaction- Specified by:
getPhaseInfoin interfaceTransactionMBean- Returns:
- the string representation of the transaction state.
-
setPhase
protected void setPhase(int newPhase) throws IOExceptionDeprecated.- Throws:
IOException
-
begin
public final void begin() throws IOExceptionDeprecated.Description copied from interface:TransactionStart a transaction validation, the validation phase needs 3 phases: begin, commit and release. The begin ensure the mutual exclusion of the current transaction.- Specified by:
beginin interfaceTransaction- Throws:
IOException- an error occurs.
-
getList
public String[] getList(String prefix)
Deprecated.Description copied from interface:TransactionReturns an array of strings naming the objects in the component started by this prefix.- Specified by:
getListin interfaceTransaction- Parameters:
prefix- the prefix of searched objects.- Returns:
- an array of strings naming the objects in the component started by this prefix.
-
create
public final void create(Serializable obj, String name) throws IOException
Deprecated.Description copied from interface:TransactionRegister the state of a newly created object in the current transaction.- Specified by:
createin interfaceTransaction- Parameters:
obj- the object to store.name- the name of the object.- Throws:
IOException- an error occurs.
-
create
public final void create(Serializable obj, String dirName, String name) throws IOException
Deprecated.Description copied from interface:TransactionRegister the state of a newly created object in the current transaction.- Specified by:
createin interfaceTransaction- Parameters:
obj- the object to store.dirName- the directory name of the object.name- the name of the object.- Throws:
IOException- an error occurs.
-
save
public final void save(Serializable obj, String name) throws IOException
Deprecated.Description copied from interface:TransactionRegister the modified state of an object in the current transaction.- Specified by:
savein interfaceTransaction- Parameters:
obj- the object to store.name- the name of the object.- Throws:
IOException- an error occurs.
-
save
public final void save(Serializable obj, String dirName, String name) throws IOException
Deprecated.Description copied from interface:TransactionRegister the modified state of an object in the current transaction.- Specified by:
savein interfaceTransaction- Parameters:
obj- the object to store.dirName- the directory name of the object.name- the name of the object.- Throws:
IOException- an error occurs.
-
save
public void save(Serializable obj, String dirName, String name, boolean first) throws IOException
Deprecated.Description copied from interface:TransactionRegister the state of an object in the current transaction.- Specified by:
savein interfaceTransaction- Parameters:
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.- Throws:
IOException- an error occurs.
-
createByteArray
public final void createByteArray(byte[] buf, String name) throws IOExceptionDeprecated.Description copied from interface:TransactionRegister a new byte array in the current transaction.- Specified by:
createByteArrayin interfaceTransaction- Parameters:
buf- the byte array to store.name- the name of the object.- Throws:
IOException- an error occurs.
-
createByteArray
public final void createByteArray(byte[] buf, String dirName, String name) throws IOExceptionDeprecated.Description copied from interface:TransactionRegister a new byte array in the current transaction.- Specified by:
createByteArrayin interfaceTransaction- Parameters:
buf- the byte array to store.dirName- the directory name of the object.name- the name of the object.- Throws:
IOException- an error occurs.
-
saveByteArray
public final void saveByteArray(byte[] buf, String name) throws IOExceptionDeprecated.Description copied from interface:TransactionRegister a modified byte array in the current transaction.- Specified by:
saveByteArrayin interfaceTransaction- Parameters:
buf- the byte array to store.name- the name of the object.- Throws:
IOException- an error occurs.
-
saveByteArray
public final void saveByteArray(byte[] buf, String dirName, String name) throws IOExceptionDeprecated.Description copied from interface:TransactionRegister a modified byte array in the current transaction.- Specified by:
saveByteArrayin interfaceTransaction- Parameters:
buf- the byte array to store.dirName- the directory name of the object.name- the name of the object.- Throws:
IOException- an error occurs.
-
saveByteArray
public void saveByteArray(byte[] buf, String dirName, String name, boolean copy, boolean first) throws IOExceptionDeprecated.Description copied from interface:TransactionRegister a modified byte array in the current transaction.- Specified by:
saveByteArrayin interfaceTransaction- Parameters:
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.- Throws:
IOException- an error occurs.
-
load
public final Object load(String name) throws IOException, ClassNotFoundException
Deprecated.Description copied from interface:TransactionLoad the specified object.- Specified by:
loadin interfaceTransaction- Parameters:
name- the name of the object.- Returns:
- the loaded object.
- Throws:
IOException- an error occurs.ClassNotFoundException- an error occurs.
-
load
public final Object load(String dirName, String name) throws IOException, ClassNotFoundException
Deprecated.Description copied from interface:TransactionLoad the specified object.- Specified by:
loadin interfaceTransaction- Parameters:
dirName- the directory name of the object.name- the name of the object.- Returns:
- the loaded object.
- Throws:
IOException- an error occurs.ClassNotFoundException- an error occurs.
-
useLoadAll
public boolean useLoadAll()
Deprecated.Returns false, this Transaction implementation does not implement an optimized loadAll method.- Specified by:
useLoadAllin interfaceTransaction- Specified by:
useLoadAllin interfaceTransactionMBean- Returns:
- false.
-
loadAll
public void loadAll(String prefix, Map map)
Deprecated.Fills the map with all objects of the component whose name begins with the prefix.- Specified by:
loadAllin interfaceTransaction- Parameters:
prefix- The prefix of searched objects.map- The map of corresponding objects.
-
loadByteArray
public final byte[] loadByteArray(String name) throws IOException
Deprecated.Description copied from interface:TransactionLoad the specified byte array.- Specified by:
loadByteArrayin interfaceTransaction- Parameters:
name- the name of the object.- Returns:
- the loaded byte array.
- Throws:
IOException- an error occurs.
-
loadByteArray
public byte[] loadByteArray(String dirName, String name) throws IOException
Deprecated.Description copied from interface:TransactionLoad the specified byte array.- Specified by:
loadByteArrayin interfaceTransaction- Parameters:
dirName- the directory name of the object.name- the name of the object.- Returns:
- the loaded byte array.
- Throws:
IOException- an error occurs.
-
delete
public final void delete(String name)
Deprecated.Description copied from interface:TransactionDeletes the specified object.- Specified by:
deletein interfaceTransaction- Parameters:
name- the name of the object.
-
delete
public void delete(String dirName, String name)
Deprecated.Description copied from interface:TransactionDeletes the specified object.- Specified by:
deletein interfaceTransaction- Parameters:
dirName- the directory name of the object.name- the name of the object.
-
deleteDir
private void deleteDir(File dir)
Deprecated.Delete the specified directory if it is empty. Also recursively delete the parent directories if they are empty.- Parameters:
dir- the directory to delete.
-
commit
public void commit(boolean release) throws IOExceptionDeprecated.Description copied from interface:TransactionCommit the current transaction.- Specified by:
commitin interfaceTransaction- Parameters:
release- if true releases the transaction at the end of the commit.- Throws:
IOException- an error occurs.
-
_commit
private void _commit() throws IOExceptionDeprecated.- Throws:
IOException
-
release
public void release() throws IOExceptionDeprecated.Description copied from interface:TransactionRelease the mutual exclusion.- Specified by:
releasein interfaceTransaction- Throws:
IOException- an error occurs.
-
stop
public void stop()
Deprecated.Stops the transaction module. It waits all transactions termination, then the module is kept in a FREE 'ready to use' state.- Specified by:
stopin interfaceTransaction
-
close
public void close()
Deprecated.Close the transaction module. It waits all transactions termination, the module will be initialized anew before reusing it.- Specified by:
closein interfaceTransaction
-
containsOperations
public boolean containsOperations()
Deprecated.Indicates whether some operations have been done in this transaction.- Specified by:
containsOperationsin interfaceTransaction- Returns:
- true if some operations are waiting for commit in this transaction.
-
getOperationCount
public int getOperationCount()
Deprecated.Returns the number of operations to be committed.- Specified by:
getOperationCountin interfaceTransaction- Returns:
- the number of operations to be committed.
-
backup
public String backup(String path) throws Exception
Deprecated.Backups the content of Transaction module. Produces a generic Backup/Restore file containing all living objects. Currently not implemented, throws an UnsupportedOperationException.- Specified by:
backupin interfaceTransaction- Specified by:
backupin interfaceTransactionMBean- Parameters:
path- Directory path to store the backup.- Returns:
- the name of created backup file.
- Throws:
Exception- An error occurs during backup.
-
-