[infinispan-commits] Infinispan SVN: r1015 - in trunk/core/src/main/java/org/infinispan/commands: write and 1 other directory.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Oct 26 13:02:26 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-10-26 13:02:26 -0400 (Mon, 26 Oct 2009)
New Revision: 1015

Modified:
   trunk/core/src/main/java/org/infinispan/commands/read/AbstractDataCommand.java
   trunk/core/src/main/java/org/infinispan/commands/write/PutKeyValueCommand.java
   trunk/core/src/main/java/org/infinispan/commands/write/RemoveCommand.java
   trunk/core/src/main/java/org/infinispan/commands/write/ReplaceCommand.java
Log:
Minor perf tweaks

Modified: trunk/core/src/main/java/org/infinispan/commands/read/AbstractDataCommand.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/commands/read/AbstractDataCommand.java	2009-10-26 16:59:52 UTC (rev 1014)
+++ trunk/core/src/main/java/org/infinispan/commands/read/AbstractDataCommand.java	2009-10-26 17:02:26 UTC (rev 1015)
@@ -22,8 +22,6 @@
 package org.infinispan.commands.read;
 
 import org.infinispan.commands.DataCommand;
-import org.infinispan.container.entries.MVCCEntry;
-import org.infinispan.context.InvocationContext;
 
 /**
  * @author Mircea.Markus at jboss.com
@@ -67,10 +65,6 @@
       return true;
    }
 
-   protected final MVCCEntry lookupMvccEntry(InvocationContext ctx, Object key) {
-      return (MVCCEntry) ctx.lookupEntry(key);
-   }
-
    public int hashCode() {
       return (key != null ? key.hashCode() : 0);
    }

Modified: trunk/core/src/main/java/org/infinispan/commands/write/PutKeyValueCommand.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/commands/write/PutKeyValueCommand.java	2009-10-26 16:59:52 UTC (rev 1014)
+++ trunk/core/src/main/java/org/infinispan/commands/write/PutKeyValueCommand.java	2009-10-26 17:02:26 UTC (rev 1015)
@@ -79,21 +79,21 @@
 
    public Object perform(InvocationContext ctx) throws Throwable {
       Object o;
-      MVCCEntry e = lookupMvccEntry(ctx, key);
-      if (e.getValue() != null && putIfAbsent) {
+      MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key);
+      Object entryValue = e.getValue();
+      if (entryValue != null && putIfAbsent) {
          successful = false;
-         return e.getValue();
+         return entryValue;
       } else {
-         notifier.notifyCacheEntryModified(key, e.getValue(), true, ctx);
+         notifier.notifyCacheEntryModified(key, entryValue, true, ctx);
 
          if (value instanceof Delta) {
             // magic
             Delta dv = (Delta) value;
-            Object existing = e.getValue();
             DeltaAware toMergeWith = null;
-            if (existing instanceof DeltaAware) toMergeWith = (DeltaAware) existing;
+            if (entryValue instanceof DeltaAware) toMergeWith = (DeltaAware) entryValue;
             e.setValue(dv.merge(toMergeWith));
-            o = existing;
+            o = entryValue;
             e.setLifespan(lifespanMillis);
             e.setMaxIdle(maxIdleTimeMillis);
          } else {

Modified: trunk/core/src/main/java/org/infinispan/commands/write/RemoveCommand.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/commands/write/RemoveCommand.java	2009-10-26 16:59:52 UTC (rev 1014)
+++ trunk/core/src/main/java/org/infinispan/commands/write/RemoveCommand.java	2009-10-26 17:02:26 UTC (rev 1015)
@@ -71,7 +71,7 @@
    }
 
    public Object perform(InvocationContext ctx) throws Throwable {
-      MVCCEntry e = lookupMvccEntry(ctx, key);
+      MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key);
       if (e == null || e.isNull()) {
          log.trace("Nothing to remove since the entry is null or we have a null entry");
          if (value == null) {

Modified: trunk/core/src/main/java/org/infinispan/commands/write/ReplaceCommand.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/commands/write/ReplaceCommand.java	2009-10-26 16:59:52 UTC (rev 1014)
+++ trunk/core/src/main/java/org/infinispan/commands/write/ReplaceCommand.java	2009-10-26 17:02:26 UTC (rev 1015)
@@ -60,7 +60,7 @@
    }
 
    public Object perform(InvocationContext ctx) throws Throwable {
-      MVCCEntry e = lookupMvccEntry(ctx, key);
+      MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key);
       if (e != null) {
          if (ctx.isOriginLocal()) {
             if (e.isNull()) return returnValue(null, false);



More information about the infinispan-commits mailing list