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.


Inner Class Summary
private static class PseudoTransactionMonitor.PTXInternalObserver
           
static class PseudoTransactionMonitor.PTXObserver
           
static class PseudoTransactionMonitor.Transaction
           
 
Field Summary
private static boolean clean_is_running
           
private  java.lang.String filename
           
private static PseudoTransactionMonitor monitor
           
static int PTX_COMMITED
           
static int PTX_COMMITING
           
static int PTX_ROLLEDBACK
           
static int PTX_ROLLINGBACK
           
static int PTX_STARTED
           
private  java.util.HashMap transactions
           
private  long txLastId
           
 
Constructor Summary
PseudoTransactionMonitor()
           
 
Method Summary
 long begin()
           
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.
 void close()
           
 void commit(long tranId)
           
private  void endsTx(long tranId, int status)
           
 java.lang.String getInfos(long tranId)
           
private  PseudoTransactionMonitor.Transaction getTransaction(long tranId)
           
 void init(org.w3c.dom.Element xml)
           
 void logTransaction(PseudoTransactionMonitor.Transaction tx)
           
 void open()
           
 void register(long tranId, PseudoTransactionMonitor.PTXObserver client)
          An observer client will be notify of a commit or rollback of the transaction
 void rollback(long tranId)
           
 void setInfos(long tranId, java.lang.String infos)
           
 void unregister(long tranId, PseudoTransactionMonitor.PTXObserver client)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

PseudoTransactionMonitor

public PseudoTransactionMonitor()
Method Detail

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)

Submarine project. free distribution of this software must include the opensource licence.
Guénolé de Cadoudal.