[jboss-svn-commits] JBL Code SVN: r29050 - labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Aug 25 09:32:14 EDT 2009


Author: jhalliday
Date: 2009-08-25 09:32:14 -0400 (Tue, 25 Aug 2009)
New Revision: 29050

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java
Log:
Added caching of ObjectStore instance for TxControl.getStore. JBTM-613


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java	2009-08-25 13:22:25 UTC (rev 29049)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TxControl.java	2009-08-25 13:32:14 UTC (rev 29050)
@@ -205,6 +205,10 @@
 
 	public static final ObjectStore getStore()
 	{
+        if(_objectStore != null) {
+            return _objectStore;
+        }
+
 		/*
 		 * Check for action store once per application. The second parameter is
 		 * the default value, which is returned if no other value is specified.
@@ -223,12 +227,17 @@
 
 		/*
 		 * Defaults to ObjectStore.OS_UNSHARED
+		 *
+		 * yes, it's unsynchronized. It does not matter much if we create more than once, we just want best
+		 * effort to avoid doing so on every call as it's a little bit expensive.
 		 */
 
 		if (sharedTransactionLog)
-			return new ObjectStore(actionStoreType, ObjectStore.OS_SHARED);
+			_objectStore = new ObjectStore(actionStoreType, ObjectStore.OS_SHARED);
 		else
-			return new ObjectStore(actionStoreType);
+			_objectStore = new ObjectStore(actionStoreType);
+
+        return _objectStore;
 	}
 
 	public static final boolean getAsyncPrepare()
@@ -325,6 +334,7 @@
 	private static TransactionStatusManager transactionStatusManager = null;
 
 	static ClassName actionStoreType = null;
+    private static ObjectStore _objectStore = null;
 
 	static byte[] xaNodeName = null;
 



More information about the jboss-svn-commits mailing list