[jboss-cvs] JBoss Messaging SVN: r1650 - in branches/Branch_1_0_XARecovery/src/main/org/jboss: jms/server messaging/core/plugin messaging/core/tx

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 28 19:20:04 EST 2006


Author: juha at jboss.org
Date: 2006-11-28 19:20:00 -0500 (Tue, 28 Nov 2006)
New Revision: 1650

Modified:
   branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/server/ServerPeer.java
   branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
   branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
Log:
7 failures down, 18+5 to go (JBMESSAGING-658)

Modified: branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/server/ServerPeer.java	2006-11-28 22:36:15 UTC (rev 1649)
+++ branches/Branch_1_0_XARecovery/src/main/org/jboss/jms/server/ServerPeer.java	2006-11-29 00:20:00 UTC (rev 1650)
@@ -67,6 +67,8 @@
  *
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
+ * 
  * @version <tt>$Revision$</tt>
  *
  * $Id$

Modified: branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java
===================================================================
--- branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-11-28 22:36:15 UTC (rev 1649)
+++ branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/plugin/JDBCPersistenceManager.java	2006-11-29 00:20:00 UTC (rev 1650)
@@ -83,6 +83,7 @@
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
  * @author <a href="mailto:Konda.Madhu at uk.mizuho-sc.com">Madhu Konda</a>
+ * @author <a href="mailto:juha at jboss.org">Juha Lindfors</a>
  *
  * @version <tt>1.1</tt>
  *
@@ -2097,24 +2098,26 @@
 //   }
    
    
-   
    public List retrievePreparedTransactions() throws Exception
    {
+      /* Note the API change for 1.0.2 XA Recovery -- List now contains instances of PreparedTxInfo<TxId, Xid>
+       * instead of direct Xids [JPL] */
+
       Connection conn = null;
       Statement st = null;
       ResultSet rs = null;
       PreparedTxInfo txInfo = null;
       TransactionWrapper wrap = new TransactionWrapper();
-      
+
       try
       {
          List transactions = new ArrayList();
-         
+
          conn = ds.getConnection();
-         
+
          st = conn.createStatement();
          rs = st.executeQuery(selectPreparedTransactions);
-         
+
          while (rs.next())
          {
            	//get the existing tx id --MK START
@@ -2124,14 +2127,14 @@
             int formatId = rs.getInt(3);
             byte[] globalTxId = rs.getBytes(4);
             Xid xid = new XidImpl(branchQual, formatId, globalTxId);
-            
+
             // create a tx info object with the result set detailsdetails
             txInfo = new PreparedTxInfo(txId, xid);
             transactions.add(txInfo);
          }
-         
+
          return transactions;
-         
+
       }
       catch (Exception e)
       {
@@ -2173,35 +2176,35 @@
          wrap.end();
       }
    }
-   
+
    /*
-    
+
     Reference counting code commented out until 1.2
-    
+
     public int getMessageReferenceCount(Serializable messageID) throws Exception
     {
     Connection conn = null;
     PreparedStatement ps = null;
     ResultSet rs = null;
     TransactionWrapper wrap = new TransactionWrapper();
-    
+
     try
     {
     conn = ds.getConnection();
-    
+
     ps = conn.prepareStatement(selectReferenceCount);
     ps.setString(1, (String)messageID);
-    
+
     rs = ps.executeQuery();
-    
+
     int count = 0;
     if (rs.next())
     {
     count = rs.getInt(1);
     }
-    
+
     if (trace) { log.trace(JDBCUtil.statementToString(selectReferenceCount, messageID) + " returned " + (count == 0 ? "no rows" : Integer.toString(count))); }
-    
+
     return count;
     }
     catch (Exception e)
@@ -2241,7 +2244,7 @@
     wrap.end();
     }
     }
-    
+
     */
    
    // Public --------------------------------------------------------

Modified: branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/tx/TransactionRepository.java
===================================================================
--- branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-11-28 22:36:15 UTC (rev 1649)
+++ branches/Branch_1_0_XARecovery/src/main/org/jboss/messaging/core/tx/TransactionRepository.java	2006-11-29 00:20:00 UTC (rev 1650)
@@ -99,7 +99,6 @@
 
 	public List getPreparedTransactions()
    {
-
 		ArrayList prepared = new ArrayList();
 
 		Iterator iter = globalToLocalMap.values().iterator();
@@ -108,23 +107,21 @@
       {
 			Transaction tx = (Transaction) iter.next();
 
-			try
+			if (tx.xid != null && tx.getState() == Transaction.STATE_PREPARED)
          {
-				if(trace)
-					log.trace("Loading and handling refs and acks to the Tx "+tx);
+            try
+            {
+               if(trace)
+                  log.trace("Loading and handling refs and acks to the Tx "+tx);
 
-            // TODO: [JPL] should this only apply to STATE_PREPARED transactions?
+               handleReferences(tx, tx.getId());
+               handleAcks(tx, tx.getId());
+            }
+            catch (Exception e)
+            {
+               log.debug("Exception in replaying a prepared transaction.", e);
+            }
 
-				handleReferences(tx, tx.getId());
-				handleAcks(tx, tx.getId());
-			}
-         catch (Exception e)
-         {
-				log.debug("Exception in replaying a prepared transaction.", e);
-			}
-
-			if (tx.xid != null && tx.getState() == Transaction.STATE_PREPARED)
-         {
 				prepared.add(tx.getXid());
 			}
 		}
@@ -136,7 +133,8 @@
 	 * Load any prepared transactions into the repository so they can be
 	 * recovered
 	 */
-	public void loadPreparedTransactions() throws Exception {
+	public void loadPreparedTransactions() throws Exception
+   {
 		List prepared = null;
 
 		prepared = persistenceManager.retrievePreparedTransactions();




More information about the jboss-cvs-commits mailing list