[jboss-svn-commits] JBL Code SVN: r27640 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 6 11:09:52 EDT 2009


Author: jhalliday
Date: 2009-07-06 11:09:51 -0400 (Mon, 06 Jul 2009)
New Revision: 27640

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/LastResourceRecord.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java
   labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
   labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/Environment.java
   labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/lastresource/LastResourceAllowedTestCase.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/LastResourceRecord.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastResourceAllowedTestCase.java
Log:
Move multipleLastResource handling out of the TransactionImple and into the LastResource. JBTM-586


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/LastResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/LastResourceRecord.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/LastResourceRecord.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -37,6 +37,7 @@
 import com.arjuna.ats.arjuna.coordinator.*;
 import com.arjuna.ats.arjuna.common.*;
 import com.arjuna.ats.arjuna.gandiva.ClassName;
+
 import java.io.PrintWriter;
 
 import com.arjuna.common.util.logging.*;
@@ -186,14 +187,58 @@
 		return "/StateManager/AbstractRecord/LastResourceRecord";
 	}
 
+    /**
+    * @message com.arjuna.ats.arjuna.lastResource.multipleWarning
+    *          [com.arjuna.ats.arjuna.lastResource.multipleWarning]
+    *          Multiple last resources have been added to the current transaction.
+    *          This is transactionally unsafe and should not be relied upon.
+    *          Current resource is {0}
+    * @message com.arjuna.ats.arjuna.lastResource.disallow
+    *          [com.arjuna.ats.arjuna.lastResource.disallow]
+    *          Adding multiple last resources is disallowed. Current resource is
+    *          {0}
+    * @message com.arjuna.ats.arjuna.lastResource.startupWarning
+    *          [com.arjuna.ats.arjuna.lastResource.startupWarning]
+    *          You have chosen to enable multiple last resources in the transaction
+    *          manager. This is transactionally unsafe and should not be relied
+    *          upon.
+    * @message com.arjuna.ats.arjuna.lastResource.disableWarning
+    *          [com.arjuna.ats.arjuna.lastResource.disableWarning]
+    *          You have chosen to disable the Multiple Last Resources warning. You will see it only once.
+    */
 	public boolean shouldAdd (AbstractRecord a)
 	{
-	    /*
-	     * OK to add as long as we are the only instance in the list.
-	     * So if we see another record with the same type, barf!
-	     */
-	    
-            return ! (a.typeIs() == typeIs()) ;
+        if( a.typeIs() == typeIs() )
+        {
+            if(ALLOW_MULTIPLE_LAST_RESOURCES)
+            {
+                if (tsLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    if (!_disableMLRWarning || (_disableMLRWarning && !_issuedWarning))
+                    {
+                        tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.lastResource.multipleWarning",
+                                new Object[] { a });
+                        _issuedWarning = true;
+                    }
+                }
+
+                return true;
+            }
+            else
+            {
+                if (tsLogger.arjLoggerI18N.isWarnEnabled())
+                {
+                    tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.lastResource.disallow",
+                            new Object[] { a });
+                }
+
+                return false;
+            }
+        }
+        else
+        {
+            return true;
+        }
 	}
 
 	public boolean shouldMerge (AbstractRecord a)
@@ -247,4 +292,33 @@
 	private OnePhaseResource _lro;
 	
 	private static final Uid ONE_PHASE_RESOURCE_UID = Uid.lastResourceUid() ;
+
+
+    private static final boolean ALLOW_MULTIPLE_LAST_RESOURCES;
+
+    private static boolean _disableMLRWarning = false;
+    private static boolean _issuedWarning = false;
+
+    static
+    {
+        final String allowMultipleLastResources = arjPropertyManager
+                .getPropertyManager().getProperty(Environment.ALLOW_MULTIPLE_LAST_RESOURCES);
+        ALLOW_MULTIPLE_LAST_RESOURCES = (allowMultipleLastResources == null ? false
+                : Boolean.valueOf(allowMultipleLastResources).booleanValue());
+        
+        if (ALLOW_MULTIPLE_LAST_RESOURCES
+                && tsLogger.arjLoggerI18N.isWarnEnabled())
+        {
+            tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.lastResource.startupWarning");
+        }
+
+        String disableMLRW = arjPropertyManager.getPropertyManager().getProperty(Environment.DISABLE_MULTIPLE_LAST_RESOURCES_WARNING, "false");
+
+        if ("true".equalsIgnoreCase(disableMLRW))
+        {
+            tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.lastResource.disableWarning");
+
+            _disableMLRWarning = true;
+        }
+    }
 }

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Environment.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -156,7 +156,10 @@
     public static final String PROCESS_IDENTIFIER = "com.arjuna.ats.internal.arjuna.utils.pid";
     public static final String BEFORECOMPLETION_WHEN_ROLLBACKONLY = "com.arjuna.ats.coordinator.beforeCompletionWhenRollbackOnly";
     public static final String CHECKEDACTION_FACTORY = "com.arjuna.ats.coordinator.checkedActionFactory";
-    
+
+    public static final String ALLOW_MULTIPLE_LAST_RESOURCES = "com.arjuna.ats.arjuna.allowMultipleLastResources";    
+    public static final String DISABLE_MULTIPLE_LAST_RESOURCES_WARNING = "com.arjuna.ats.arjuna.disableMultipleLastResourcesWarning";
+
     /**
       * Constant that holds the name of the environment property
       * for specifying the bind address for transaction services

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -85,24 +85,6 @@
  * @message com.arjuna.ats.internal.jta.transaction.arjunacore.lastResourceOptimisationInterface
  *          [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResourceOptimisationInterface] -
  *          failed to load Last Resource Optimisation Interface
- *
- * @message com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning
- *          [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning]
- *          Multiple last resources have been added to the current transaction.
- *          This is transactionally unsafe and should not be relied upon.
- *          Current resource is {0}
- * @message com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow
- *          [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow]
- *          Adding multiple last resources is disallowed. Current resource is
- *          {0}
- * @message com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.startupWarning
- *          [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.startupWarning]
- *          You have chosen to enable multiple last resources in the transaction
- *          manager. This is transactionally unsafe and should not be relied
- *          upon.
- * @message com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disableWarning
- *          [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disableWarning]
- *          You have chosen to disable the Multiple Last Resources warning. You will see it only once.
  */
 
 public class TransactionImple implements javax.transaction.Transaction,
@@ -795,8 +777,8 @@
                         // so we must do so directly.  start may fail due to dupl xid or other reason, and transactions
                         // may rollback async, for which reasons we can't call add before start.
                         // The xid will change on each pass of the loop, so we need to create a new record on each pass.
-                        // The creation will fail in the case of multiple last resources being disallowed, in which
-                        // case we don't call start on the resource at all. see JBTM-362 and JBTM-363
+                        // The add will fail in the case of multiple last resources being disallowed
+                        // see JBTM-362 and JBTM-363
                         AbstractRecord abstractRecord = createRecord(xaRes, params, xid);
                         if(abstractRecord != null) {
                             xaRes.start(xid, xaStartNormal);
@@ -964,43 +946,7 @@
                 || ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE
                 .isInstance(xaRes)))
         {
-            if (lastResourceCount == 1)
-            {
-                if (jtaLogger.loggerI18N.isWarnEnabled())
-                {
-                    if (ALLOW_MULTIPLE_LAST_RESOURCES)
-                    {
-                        if (!_disableMLRWarning || (_disableMLRWarning && !_issuedWarning))
-                        {
-                            jtaLogger.loggerI18N
-                                    .warn(
-                                            "com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning",
-                                            new Object[]
-                                                    { xaRes });
-                            
-                            _issuedWarning = true;
-                        }
-                    }
-                    else
-                    {
-                        jtaLogger.loggerI18N
-                                .warn(
-                                        "com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow",
-                                        new Object[]
-                                                { xaRes });
-                    }
-                }
-            }
-
-            if ((lastResourceCount++ == 0) || ALLOW_MULTIPLE_LAST_RESOURCES)
-            {
-                record = new LastResourceRecord(new XAOnePhaseResource(
-                        xaRes, xid, params));
-            }
-            else
-            {
-                record = null;
-            }
+            record = new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params));
         }
         else
         {
@@ -1917,23 +1863,10 @@
 
     private Throwable _rollbackOnlyCallerStacktrace;
 
-	/**
-	 * Count of last resources seen in this transaction.
-	 */
-	private int lastResourceCount;
-
-	/**
-	 * Do we allow multiple last resources?
-	 */
-	private static final boolean ALLOW_MULTIPLE_LAST_RESOURCES;
-
 	private static final boolean XA_TRANSACTION_TIMEOUT_ENABLED;
 
 	private static final Class LAST_RESOURCE_OPTIMISATION_INTERFACE;
-	
-	private static boolean _disableMLRWarning = false;
-	private static boolean _issuedWarning = false;
-	
+
 	static
 	{
 		final String xaTransactionTimeoutEnabled = jtaPropertyManager.getPropertyManager()
@@ -1973,26 +1906,6 @@
 		}
 		LAST_RESOURCE_OPTIMISATION_INTERFACE = lastResourceOptimisationInterface;
 
-		final String allowMultipleLastResources = jtaPropertyManager
-				.getPropertyManager().getProperty(
-						Environment.ALLOW_MULTIPLE_LAST_RESOURCES);
-		ALLOW_MULTIPLE_LAST_RESOURCES = (allowMultipleLastResources == null ? false
-				: Boolean.valueOf(allowMultipleLastResources).booleanValue());
-		if (ALLOW_MULTIPLE_LAST_RESOURCES
-				&& jtaLogger.loggerI18N.isWarnEnabled())
-		{
-			jtaLogger.loggerI18N
-					.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.startupWarning");
-		}
-		
-		String disableMLRW = jtaPropertyManager.getPropertyManager().getProperty(Environment.DISABLE_MULTIPLE_LAST_RESOURCES_WARNING, "false");
-		
-		if ("true".equalsIgnoreCase(disableMLRW))
-		{
-		    jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disableWarning");
-		    
-		    _disableMLRWarning = true;
-		}
 	}
 
 	private static ConcurrentHashMap _transactions = new ConcurrentHashMap();

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/Environment.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/Environment.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/Environment.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -61,9 +61,5 @@
 	public static final String XA_ERROR_HANDLER = "com.arjuna.ats.jta.xaErrorHandler";
     public static final String XA_TRANSACTION_TIMEOUT_ENABLED = "com.arjuna.ats.jta.xaTransactionTimeoutEnabled";
     public static final String LAST_RESOURCE_OPTIMISATION_INTERFACE = "com.arjuna.ats.jta.lastResourceOptimisationInterface";
-    public static final String ALLOW_MULTIPLE_LAST_RESOURCES = "com.arjuna.ats.jta.allowMultipleLastResources";
-    
-    public static final String DISABLE_MULTIPLE_LAST_RESOURCES_WARNING = "com.arjuna.ats.jta.disableMultipleLastResourcesWarning";
-
 }
 

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/lastresource/LastResourceAllowedTestCase.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/lastresource/LastResourceAllowedTestCase.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/lastresource/LastResourceAllowedTestCase.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -29,7 +29,7 @@
 import junit.framework.TestCase;
 
 import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
-import com.arjuna.ats.jta.common.Environment;
+import com.arjuna.ats.arjuna.common.Environment;
 
 public class LastResourceAllowedTestCase extends TestCase
 {

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/LastResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/LastResourceRecord.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/LastResourceRecord.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -43,8 +43,12 @@
 
 import com.arjuna.ArjunaOTS.OTSAbstractRecord;
 import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.arjuna.ats.arjuna.common.Environment;
 import com.arjuna.ats.arjuna.coordinator.RecordType;
+import com.arjuna.ats.arjuna.logging.tsLogger;
 import com.arjuna.ats.internal.jta.transaction.jts.TransactionImple;
+import com.arjuna.ats.jta.logging.jtaLogger;
 
 /**
  * XAResourceRecord implementing the Last Resource Commit Optimisation.
@@ -128,8 +132,87 @@
 		return false;
 	}
     
+    /**
+    * @message com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.multipleWarning
+    *          [com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.multipleWarning]
+    *          Multiple last resources have been added to the current transaction.
+    *          This is transactionally unsafe and should not be relied upon.
+    *          Current resource is {0}
+    * @message com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disallow
+    *          [com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disallow]
+    *          Adding multiple last resources is disallowed. Current resource is
+    *          {0}
+    * @message com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.startupWarning
+    *          [com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.startupWarning]
+    *          You have chosen to enable multiple last resources in the transaction
+    *          manager. This is transactionally unsafe and should not be relied
+    *          upon.
+    * @message com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disableWarning
+    *          [com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disableWarning]
+    *          You have chosen to disable the Multiple Last Resources warning. You will see it only once.
+    */
     public boolean shouldAdd(OTSAbstractRecord record) throws SystemException
     {
-        return (record.type_id() == type_id()) ;
+        if( record.type_id() == type_id() )
+        {
+            if(ALLOW_MULTIPLE_LAST_RESOURCES)
+            {
+                if (jtaLogger.loggerI18N.isWarnEnabled())
+                {
+                    if (!_disableMLRWarning || (_disableMLRWarning && !_issuedWarning))
+                    {
+                        jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.multipleWarning",
+                                new Object[] { record });
+                        _issuedWarning = true;
+                    }
+                }
+
+                return true;
+            }
+            else
+            {
+                if (jtaLogger.loggerI18N.isWarnEnabled())
+                {
+                    jtaLogger.loggerI18N.warn(
+                            "com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disallow",
+                            new Object[] { record });
+                }
+
+                return false;
+            }
+        }
+        else
+        {
+            return true;
+        }
     }
+
+    private static final boolean ALLOW_MULTIPLE_LAST_RESOURCES;
+
+    private static boolean _disableMLRWarning = false;
+    private static boolean _issuedWarning = false;
+
+    static
+    {
+        final String allowMultipleLastResources = arjPropertyManager
+                .getPropertyManager().getProperty(Environment.ALLOW_MULTIPLE_LAST_RESOURCES);
+        ALLOW_MULTIPLE_LAST_RESOURCES = (allowMultipleLastResources == null ? false
+                : Boolean.valueOf(allowMultipleLastResources).booleanValue());
+
+        if (ALLOW_MULTIPLE_LAST_RESOURCES
+                && jtaLogger.loggerI18N.isWarnEnabled())
+        {
+            jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.startupWarning");
+        }
+
+        String disableMLRW = arjPropertyManager.getPropertyManager().getProperty(Environment.DISABLE_MULTIPLE_LAST_RESOURCES_WARNING, "false");
+
+        if ("true".equalsIgnoreCase(disableMLRW))
+        {
+            jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.jts.orbspecific.lastResource.disableWarning");
+
+            _disableMLRWarning = true;
+        }
+    }
+
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -117,23 +117,6 @@
  * @message com.arjuna.ats.internal.jta.transaction.jts.lastResourceOptimisationInterface
  * 			[com.arjuna.ats.internal.jta.transaction.jts.lastResourceOptimisationInterface] - failed
  *          to load Last Resource Optimisation Interface
- *
- * @message com.arjuna.ats.internal.jta.transaction.jts.lastResource.multipleWarning
- *          [com.arjuna.ats.internal.jta.transaction.jts.lastResource.multipleWarning]
- *          Multiple last resources have been added to the current transaction.
- *          This is transactionally unsafe and should not be relied upon.
- *          Current resource is {0}
- * @message com.arjuna.ats.internal.jta.transaction.jts.lastResource.disallow
- *          [com.arjuna.ats.internal.jta.transaction.jts.lastResource.disallow]
- *          Adding multiple last resources is disallowed.
- *          Current resource is {0}
- * @message com.arjuna.ats.internal.jta.transaction.jts.lastResource.startupWarning
- *          [com.arjuna.ats.internal.jta.transaction.jts.lastResource.startupWarning]
- *          You have chosen to enable multiple last resources in the transaction manager.
- *          This is transactionally unsafe and should not be relied upon.
- * @message com.arjuna.ats.internal.jta.transaction.jts.lastResource.disableWarning
- *          [com.arjuna.ats.internal.jta.transaction.jts.lastResource.disableWarning]
- *          You have chosen to disable the Multiple Last Resources warning. You will see it only once.
  */
 
 public class TransactionImple implements javax.transaction.Transaction,
@@ -792,8 +775,8 @@
                         // so we must do so directly.  start may fail due to dupl xid or other reason, and transactions
                         // may rollback async, for which reasons we can't call add before start.
                         // The xid will change on each pass of the loop, so we need to create a new record on each pass.
-                        // The creation will fail in the case of multiple last resources being disallowed, in which
-                        // case we don't call start on the resource at all. see JBTM-362 and JBTM-363
+                        // The registerResource will fail in the case of multiple last resources being disallowed.
+                        // see JBTM-362 and JBTM-363
                         XAResourceRecord xaResourceRecord = createRecord(xaRes, params, xid);
                         if(xaResourceRecord != null) {
                             xaRes.start(xid, XAResource.TMNOFLAGS);
@@ -944,42 +927,7 @@
                 || ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE
                 .isInstance(xaRes)))
         {
-            if (lastResourceCount == 1)
-            {
-                if (jtaLogger.loggerI18N.isWarnEnabled())
-                {
-                    if (ALLOW_MULTIPLE_LAST_RESOURCES)
-                    {
-                        if (!_disableMLRWarning || (_disableMLRWarning && !_issuedWarning))
-                        {
-                            jtaLogger.loggerI18N
-                                    .warn(
-                                            "com.arjuna.ats.internal.jta.transaction.jts.lastResource.multipleWarning",
-                                            new Object[]
-                                                    { xaRes });
-
-                            _issuedWarning = true;
-                        }
-                    }
-                    else
-                    {
-                        jtaLogger.loggerI18N
-                                .warn(
-                                        "com.arjuna.ats.internal.jta.transaction.jts.lastResource.disallow",
-                                        new Object[]
-                                                { xaRes });
-                    }
-                }
-            }
-
-            if ((lastResourceCount++ == 0) || ALLOW_MULTIPLE_LAST_RESOURCES)
-            {
                 record = new LastResourceRecord(this, xaRes, xid, params);
-            }
-            else
-            {
-                record = null;
-            }
         }
         else
         {
@@ -1922,22 +1870,9 @@
 
     private Throwable _rollbackOnlyCallerStacktrace;
 
-        /**
-         * Count of last resources seen in this transaction.
-         */
-        private int lastResourceCount ;
-
-        /**
-         * Do we allow multiple last resources?
-         */
-        private static final boolean ALLOW_MULTIPLE_LAST_RESOURCES ;
-
 	private static final boolean XA_TRANSACTION_TIMEOUT_ENABLED ;
 	private static final Class LAST_RESOURCE_OPTIMISATION_INTERFACE ;
 
-	private static boolean _disableMLRWarning = false;
-        private static boolean _issuedWarning = false;
-
 	static
 	{
 		final String xaTransactionTimeoutEnabled = jtsPropertyManager.getPropertyManager().getProperty(Environment.XA_TRANSACTION_TIMEOUT_ENABLED) ;
@@ -1967,22 +1902,6 @@
 			}
 		}
 		LAST_RESOURCE_OPTIMISATION_INTERFACE = lastResourceOptimisationInterface ;
-
-                final String allowMultipleLastResources = jtsPropertyManager.getPropertyManager().getProperty(Environment.ALLOW_MULTIPLE_LAST_RESOURCES) ;
-                ALLOW_MULTIPLE_LAST_RESOURCES = (allowMultipleLastResources == null ? false : Boolean.valueOf(allowMultipleLastResources).booleanValue()) ;
-                if (ALLOW_MULTIPLE_LAST_RESOURCES && jtaLogger.loggerI18N.isWarnEnabled())
-                {
-                    jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.lastResource.startupWarning");
-                }
-
-                String disableMLRW = jtaPropertyManager.getPropertyManager().getProperty(Environment.DISABLE_MULTIPLE_LAST_RESOURCES_WARNING, "false");
-
-                if ("true".equalsIgnoreCase(disableMLRW))
-                {
-                    jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.lastResource.disableWarning");
-
-                    _disableMLRWarning = true;
-                }
 	}
 
     private static ConcurrentHashMap _transactions = new ConcurrentHashMap();

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastResourceAllowedTestCase.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastResourceAllowedTestCase.java	2009-07-06 15:07:28 UTC (rev 27639)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/tests/classes/com/hp/mwtests/ts/jta/jts/lastresource/LastResourceAllowedTestCase.java	2009-07-06 15:09:51 UTC (rev 27640)
@@ -27,7 +27,7 @@
 import javax.transaction.TransactionManager;
 
 import com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple;
-import com.arjuna.ats.jta.common.Environment;
+import com.arjuna.ats.arjuna.common.Environment;
 import com.hp.mwtests.ts.jta.jts.JTSTestCase;
 
 public class LastResourceAllowedTestCase extends JTSTestCase
@@ -41,22 +41,22 @@
     public void testAllowed()
         throws SystemException, NotSupportedException, RollbackException
     {
-        final LastOnePhaseResource firstResource = new LastOnePhaseResource() ;
-        final LastOnePhaseResource secondResource = new LastOnePhaseResource() ;
-        final LastOnePhaseResource thirdResource = new LastOnePhaseResource() ;
+        final LastOnePhaseResource firstResource = new LastOnePhaseResource();
+        final LastOnePhaseResource secondResource = new LastOnePhaseResource();
+        final LastOnePhaseResource thirdResource = new LastOnePhaseResource();
         
-        final TransactionManager tm = new TransactionManagerImple() ;
+        final TransactionManager tm = new TransactionManagerImple();
         tm.begin() ;
         try
         {
-            final Transaction tx = tm.getTransaction() ;
-            assertTrue("First resource enlisted", tx.enlistResource(firstResource)) ;
-            assertTrue("Second resource enlisted", tx.enlistResource(secondResource)) ;
-            assertTrue("Third resource enlisted", tx.enlistResource(thirdResource)) ;
+            final Transaction tx = tm.getTransaction();
+            assertTrue("First resource enlisted", tx.enlistResource(firstResource));
+            assertTrue("Second resource enlisted", tx.enlistResource(secondResource));
+            assertTrue("Third resource enlisted", tx.enlistResource(thirdResource));
         }
         finally
         {
-            tm.rollback() ;
+            tm.rollback();
         }
     }
 }




More information about the jboss-svn-commits mailing list