[jboss-svn-commits] JBL Code SVN: r30850 - labs/jbosstm/branches/JBOSSTS_4_2_3_SP5_CP05_JBPAPP-3174/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Dec 29 02:21:54 EST 2009


Author: vicky.kak at jboss.com
Date: 2009-12-29 02:21:53 -0500 (Tue, 29 Dec 2009)
New Revision: 30850

Modified:
   labs/jbosstm/branches/JBOSSTS_4_2_3_SP5_CP05_JBPAPP-3174/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
Log:


Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_SP5_CP05_JBPAPP-3174/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_SP5_CP05_JBPAPP-3174/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java	2009-12-29 07:00:58 UTC (rev 30849)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_SP5_CP05_JBPAPP-3174/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java	2009-12-29 07:21:53 UTC (rev 30850)
@@ -380,6 +380,9 @@
 		}
 		else
 		{
+			if (_theXAResource == null)
+				_theXAResource = getNewXAResource();
+
 			if (_theXAResource != null)
 			{
 				if (_heuristic != TwoPhaseOutcome.FINISH_OK)
@@ -459,7 +462,31 @@
 				}
 			}
 			else
-				return TwoPhaseOutcome.FINISH_ERROR;
+			{
+			    if (jtaLogger.loggerI18N.isWarnEnabled())
+			    {
+			    	jtaLogger.loggerI18N
+				    	.warn(
+				    			"com.arjuna.ats.internal.jta.resources.arjunacore.noresource",
+				    			new Object[] {_tranID});
+			    }
+
+			    if (XAResourceRecord._assumedComplete)
+			    {	
+					if (jtaLogger.loggerI18N.isInfoEnabled())
+					{
+					    jtaLogger.loggerI18N
+						.info(
+						      "com.arjuna.ats.internal.jta.resources.arjunacore.assumecomplete",
+						      new Object[] {_tranID});
+					}
+
+					return TwoPhaseOutcome.FINISH_OK;
+			    }
+			    else
+			    	return TwoPhaseOutcome.FINISH_ERROR;
+			}
+
 		}
 
 		return TwoPhaseOutcome.FINISH_OK;
@@ -557,6 +584,8 @@
 						case XAException.XA_HEURMIX:
 							return TwoPhaseOutcome.HEURISTIC_MIXED;
 						case XAException.XAER_NOTA:
+							if (_recovered)
+								break; // committed previously and recovery completed
 						case XAException.XAER_PROTO:
 							break;
 						case XAException.XA_RETRY:
@@ -1157,9 +1186,11 @@
 	private boolean _valid;
 	private int _heuristic;
 	private TransactionImple _theTransaction;
+	private boolean _recovered = false;
 
 	private static boolean _rollbackOptimization = false;
-
+	private static boolean _assumedComplete = false;
+	
 	static
 	{
 		String optimization = jtaPropertyManager.propertyManager.getProperty(
@@ -1167,6 +1198,24 @@
 
 		if (optimization.equals("ON"))
 			_rollbackOptimization = true;
+		/*
+		 * WARNING: USE WITH EXTEREME CARE!!
+		 *
+		 * This assumes that if there is no XAResource that can deal with an Xid
+		 * after recovery, then we failed after successfully committing the transaction
+		 * but before updating the log. In which case we just need to ignore this
+		 * resource and remove the entry from the log.
+		 *
+		 * BUT if not all XAResourceRecovery instances are correctly implemented
+		 * (or present) we may end up removing participants that have not been dealt
+		 * with. Hence USE WITH EXTREME CARE!!
+		 */
+
+		String assumedComplete = jtaPropertyManager.propertyManager.getProperty(
+				Environment.XA_ASSUME_RECOVERY_COMPLETE, "FALSE");
+
+		if (assumedComplete.equalsIgnoreCase("true"))
+			_assumedComplete = true;
 	}
 
 }



More information about the jboss-svn-commits mailing list