submarine.connectors
Class PseudoTransactionMonitor
java.lang.Object
|
+--submarine.connectors.PseudoTransactionMonitor
- All Implemented Interfaces:
- Resource, XMLConfigurable
- public class PseudoTransactionMonitor
- extends java.lang.Object
- implements Resource
A pseudo transaction monitor that do not implements the JTA specs.
Only one ressource of this type can be created in submarine.
The use mode is just about allowing transaction actors to be
notified of a commit or rollback of a global transaction and so
beiing able to cancel some operations.
PTX prefix means PseudoTransaction.
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
monitor
private static PseudoTransactionMonitor monitor
clean_is_running
private static boolean clean_is_running
filename
private java.lang.String filename
PTX_STARTED
public static final int PTX_STARTED
PTX_COMMITED
public static final int PTX_COMMITED
PTX_ROLLEDBACK
public static final int PTX_ROLLEDBACK
PTX_COMMITING
public static final int PTX_COMMITING
PTX_ROLLINGBACK
public static final int PTX_ROLLINGBACK
transactions
private java.util.HashMap transactions
txLastId
private long txLastId
PseudoTransactionMonitor
public PseudoTransactionMonitor()
cleanTxLog
public static long cleanTxLog(java.lang.String logName)
- return the max txId found
// load the transaction log and iterate on it to remove all the
// commited transaction. The rollbacked transaction and the missed
// end of transaction are notified in a errors file
// after the open call, a new empty log is created for future transactions
logTransaction
public void logTransaction(PseudoTransactionMonitor.Transaction tx)
open
public void open()
- Specified by:
open
in interface Resource
close
public void close()
- Specified by:
close
in interface Resource
init
public void init(org.w3c.dom.Element xml)
throws java.lang.Exception
- Specified by:
init
in interface XMLConfigurable
- Following copied from interface:
submarine.core.XMLConfigurable
- Parameters:
xml
- - Throws:
java.lang.Exception
-
begin
public long begin()
getTransaction
private PseudoTransactionMonitor.Transaction getTransaction(long tranId)
endsTx
private void endsTx(long tranId,
int status)
commit
public void commit(long tranId)
rollback
public void rollback(long tranId)
register
public void register(long tranId,
PseudoTransactionMonitor.PTXObserver client)
- An observer client will be notify of a commit or rollback of the transaction
unregister
public void unregister(long tranId,
PseudoTransactionMonitor.PTXObserver client)
setInfos
public void setInfos(long tranId,
java.lang.String infos)
getInfos
public java.lang.String getInfos(long tranId)