6 Replies Latest reply on Jan 19, 2010 7:38 AM by marklittle

    What is the real difference between two TransactionManager implementations?

      Hi, all:

      I studied Jboss TS recently, here I hava some problems,

      Simply, below code could complete a transaction:

       

           //get transaction manager
           TransactionManager tm = com.arjuna.ats.jta.TransactionManager
                               .transactionManager();
           tm.begin();// start a transaction
           Transaction t = tm.getTransaction();
      
           //get XAConnection from 192.168.65.247, which is oracle
           XAConnection conn247 = Database247.getXAConnection();
           XAResource rs247 = conn247.getXAResource();
           t.enlistResource(rs247);
                     
           //get XAConnection from 192.168.65.248, which is oracle
           XAConnection conn248 = Database248.getXAConnection();
           XAResource rs248 = conn248.getXAResource();
           t.enlistResource(rs248);
      
           //execute the insert SQL, don't care
           String sql = "insert into ts values ('" + t + "')";
           DBOperator.execSQL(conn247.getConnection(), sql);
           DBOperator.execSQL(conn248.getConnection(), sql);
           t.rollback();
           // t.commit();
      

       

      If there is no jbossts-properties.xml in class path, the implementation com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple wil be used and the transaction works well although the Jboss TS is not running.

      If there is a jbossts-properties.xml at class path, and it contains below content:

      <property name="com.arjuna.ats.jta.jtaTMImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple"/>
      <property name="com.arjuna.ats.jta.jtaUTImplementation" value="com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple"/>
      
      

       

       

      The implementation com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple will be used, this time it is more complex:

      (1) Need the Jboss TS started once, because the application need the file in objectStoreDir\HashedActionStore\defaultStore\RecoveryCoordinator\#128#, the recovery service generate this file.

      (2)The ObjectStoreDir configuration in the class path must be same with the configuration used by Jboss TS.

       <property name="com.arjuna.ats.arjuna.objectstore.objectStoreDir" value="e:/objectStoreDir"/>

      After these works, the transaction works well too.

      My questions:

      1. What is the difference between two implementtations?

      2. The documentation explains that the second implementation support distributed transaction, what the distribute transaction like? In my sample, is that a distribute transaction?

      3. In real produce env, it not possible put the jbossts-properties.xml in class path, how do I use the TransactionManager support distribute transaction?

      4. When use the second implementation is appropriate?

      5. I can't find the advantage using the second implementation.

       

      Please help explain above problems.

      Thank you very much!