[infinispan-commits] Infinispan SVN: r813 - trunk/core/src/main/java/org/infinispan/factories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Sep 14 10:32:01 EDT 2009


Author: galder.zamarreno at jboss.com
Date: 2009-09-14 10:32:01 -0400 (Mon, 14 Sep 2009)
New Revision: 813

Modified:
   trunk/core/src/main/java/org/infinispan/factories/EntryFactoryImpl.java
Log:
Only wrap entry when reading if repeatable read in use and in transaction. Never when reading and using read committed. TODO removed.

Modified: trunk/core/src/main/java/org/infinispan/factories/EntryFactoryImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/EntryFactoryImpl.java	2009-09-14 14:24:07 UTC (rev 812)
+++ trunk/core/src/main/java/org/infinispan/factories/EntryFactoryImpl.java	2009-09-14 14:32:01 UTC (rev 813)
@@ -85,17 +85,16 @@
          cacheEntry = container.get(key);
 
          // do not bother wrapping though if this is not in a tx.  repeatable read etc are all meaningless unless there is a tx.
-         // TODO: Do we need to wrap for reading even IN a TX if we are using read-committed?
-         if (!ctx.isInTxScope()) {
-            if (cacheEntry != null) ctx.putLookedUpEntry(key, cacheEntry);
-            return cacheEntry;
-         } else {
+         if (useRepeatableRead && ctx.isInTxScope()) {
             MVCCEntry mvccEntry = cacheEntry == null ?
-                  createWrappedEntry(key, null, false, false, -1) :
-                  createWrappedEntry(key, cacheEntry.getValue(), false, false, cacheEntry.getLifespan());
-            if (mvccEntry != null) ctx.putLookedUpEntry(key, mvccEntry);
-            return mvccEntry;
+                     createWrappedEntry(key, null, false, false, -1) :
+                     createWrappedEntry(key, cacheEntry.getValue(), false, false, cacheEntry.getLifespan());
+               if (mvccEntry != null) ctx.putLookedUpEntry(key, mvccEntry);
+               return mvccEntry;
          }
+         // if not in transaction and repeatable read, or simply read committed (regardless of whether in TX or not), do not wrap
+         if (cacheEntry != null) ctx.putLookedUpEntry(key, cacheEntry);
+            return cacheEntry;
       } else {
          if (trace) log.trace("Key is already in context");
          return cacheEntry;



More information about the infinispan-commits mailing list