|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.dyade.aaa.util.AbstractTransaction
fr.dyade.aaa.ext.NGTransaction
public final class NGTransaction
The NGTransaction class implements a transactional storage. For efficiency it uses multiples files for its transaction journal, the final storage is provided through the Repository interface on filesystem or database.
Be Careful, the configuration properties don't work for the transaction component: these properties are saved in the transaction repository so they can not be used to configure it.
Transaction
,
Repository
,
FileRepository
,
DBRepository
,
MySqlDBRepository
Nested Class Summary | |
---|---|
static class |
NGTransaction.LogFile
|
Nested classes/interfaces inherited from class fr.dyade.aaa.util.AbstractTransaction |
---|
AbstractTransaction.Context |
Field Summary |
---|
Fields inherited from class fr.dyade.aaa.util.AbstractTransaction |
---|
dir, logmon, OOS_STREAM_HEADER, perThreadContext, phase, startTime |
Fields inherited from interface fr.dyade.aaa.util.Transaction |
---|
COMMIT, FINALIZE, FREE, GARBAGE, INIT, Kb, Mb, PhaseInfo, ROLLBACK, RUN |
Constructor Summary | |
---|---|
NGTransaction()
|
Method Summary | |
---|---|
void |
close()
Close the transaction module. |
void |
commit(boolean release)
Commit the current transaction. |
void |
delete(java.lang.String dirName,
java.lang.String name)
Deletes the specified object. |
int |
getCommitCount()
Returns the number of commit operation since starting up. |
int |
getGarbageCount()
Returns the number of garbage operation since starting up. |
int |
getGarbageRatio()
Returns the ratio of garbage operations since starting up. |
long |
getGarbageTime()
Returns the cumulated time of garbage operations since starting up. |
java.lang.String[] |
getList(java.lang.String prefix)
Returns an array of strings naming the persistent objects denoted by a name that satisfy the specified prefix. |
int |
getLogFileSize()
Returns the current size of disk log in Kb. |
int |
getLogMemoryCapacity()
Returns the initial capacity of global in memory log (by default 4096). |
int |
getLogMemorySize()
Returns the number of operation in the memory log. |
int |
getLogThresholdOperation()
Returns the pool size for operation objects, by default 1000. |
int |
getMaxLogFileSize()
Returns the maximum size of disk log in Mb, by default 16Mb. |
int |
getNbBadDeletedObjects()
Returns the number of useless delete operation on repository. |
int |
getNbDeletedObjects()
Returns the number of delete operation on repository. |
int |
getNbLoadedFromLog()
Returns the number of load operation from a log file since last start. |
int |
getNbLoadedObjects()
Returns the number of load operation from repository. |
int |
getNbLogFiles()
Returns the number of rolled log files. |
int |
getNbSavedObjects()
Returns the number of save operation to repository. |
java.lang.String |
getPersistenceDir()
Returns the path of persistence directory. |
java.lang.String |
getRepositoryImpl()
Returns the Repository classname implementation. |
void |
initRepository()
|
boolean |
isPersistent()
Tests if the Transaction component is persistent. |
boolean |
isSyncOnWrite()
Returns true if every write in the log file is synced to disk. |
byte[] |
loadByteArray(java.lang.String dirName,
java.lang.String name)
Load the specified byte array. |
protected void |
saveInLog(byte[] buf,
java.lang.String dirName,
java.lang.String name,
java.util.Hashtable log,
boolean copy,
boolean first)
Save an object state already serialized. |
void |
setMaxLogFileSize(int size)
Sets the maximum size of disk log in Mb. |
protected void |
setPhase(int newPhase)
Changes the transaction state. |
void |
stop()
Stops the transaction module. |
java.lang.String |
toString()
Returns a string representation for this object. |
Methods inherited from class fr.dyade.aaa.util.AbstractTransaction |
---|
begin, create, create, createByteArray, createByteArray, delete, getPhase, getPhaseInfo, getStartTime, init, load, load, loadByteArray, release, save, save, save, saveByteArray, saveByteArray, saveByteArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fr.dyade.aaa.util.TransactionMBean |
---|
getPhase, getPhaseInfo, getStartTime |
Constructor Detail |
---|
public NGTransaction()
Method Detail |
---|
public final int getLogMemoryCapacity()
getLogMemoryCapacity
in interface NGTransactionMBean
public int getLogMemorySize()
getLogMemorySize
in interface NGTransactionMBean
public final int getMaxLogFileSize()
getMaxLogFileSize
in interface NGTransactionMBean
public final void setMaxLogFileSize(int size)
setMaxLogFileSize
in interface NGTransactionMBean
size
- The maximum size of disk log in Mb.public final int getLogFileSize()
getLogFileSize
in interface NGTransactionMBean
public final int getNbLogFiles()
getNbLogFiles
in interface NGTransactionMBean
public boolean isSyncOnWrite()
NGTransactionMBean
isSyncOnWrite
in interface NGTransactionMBean
public final int getLogThresholdOperation()
operation
objects, by default 1000.
getLogThresholdOperation
in interface NGTransactionMBean
operation
objects.public final int getCommitCount()
getCommitCount
in interface NGTransactionMBean
public final int getGarbageCount()
getGarbageCount
in interface NGTransactionMBean
public long getGarbageTime()
getGarbageTime
in interface NGTransactionMBean
public int getNbLoadedFromLog()
getNbLoadedFromLog
in interface NGTransactionMBean
public int getGarbageRatio()
getGarbageRatio
in interface NGTransactionMBean
public java.lang.String getRepositoryImpl()
getRepositoryImpl
in interface NGTransactionMBean
public int getNbSavedObjects()
getNbSavedObjects
in interface NGTransactionMBean
public int getNbDeletedObjects()
getNbDeletedObjects
in interface NGTransactionMBean
public int getNbBadDeletedObjects()
getNbBadDeletedObjects
in interface NGTransactionMBean
public int getNbLoadedObjects()
getNbLoadedObjects
in interface NGTransactionMBean
public final void initRepository() throws java.io.IOException
initRepository
in class AbstractTransaction
java.io.IOException
public boolean isPersistent()
isPersistent
in interface Transaction
isPersistent
in interface TransactionMBean
public java.lang.String getPersistenceDir()
protected final void setPhase(int newPhase)
AbstractTransaction
setPhase
in class AbstractTransaction
newPhase
- the new transaction state.public java.lang.String[] getList(java.lang.String prefix)
getList
in interface Transaction
prefix
- the prefix
protected final void saveInLog(byte[] buf, java.lang.String dirName, java.lang.String name, java.util.Hashtable log, boolean copy, boolean first) throws java.io.IOException
saveInLog
in class AbstractTransaction
buf
- the byte array containing the state of the object.dirName
- the directory name of the object.name
- the name of the object.log
- the log to use.copy
- the byte array can be modified, copy it.first
- the object is a new one.
java.io.IOException
public byte[] loadByteArray(java.lang.String dirName, java.lang.String name) throws java.io.IOException
Transaction
loadByteArray
in interface Transaction
dirName
- the directory name of the object.name
- the name of the object.
java.io.IOException
public final void delete(java.lang.String dirName, java.lang.String name)
Transaction
delete
in interface Transaction
dirName
- the directory name of the object.name
- the name of the object.public final void commit(boolean release) throws java.io.IOException
Transaction
commit
in interface Transaction
release
- if true releases the transaction at the end of the commit.
java.io.IOException
public void stop()
stop
in interface Transaction
public void close()
close
in interface Transaction
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |