jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1504167 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java
Date Wed, 17 Jul 2013 15:10:17 GMT
Author: thomasm
Date: Wed Jul 17 15:10:17 2013
New Revision: 1504167

URL: http://svn.apache.org/r1504167
Log:
OAK-825 Small MongoMK performance improvement

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java?rev=1504167&r1=1504166&r2=1504167&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MemoryDocumentStore.java
Wed Jul 17 15:10:17 2013
@@ -221,7 +221,6 @@ public class MemoryDocumentStore impleme
     public static void applyChanges(Map<String, Object> target, UpdateOp update) {
         for (Entry<String, Operation> e : update.changes.entrySet()) {
             String k = e.getKey();
-            String[] kv = k.split("\\.");
             Operation op = e.getValue();
             switch (op.type) {
             case SET: {
@@ -238,6 +237,7 @@ public class MemoryDocumentStore impleme
                 break;
             }
             case SET_MAP_ENTRY: {
+                String[] kv = splitInTwo(k, '.');
                 Object old = target.get(kv[0]);
                 @SuppressWarnings("unchecked")
                 Map<String, Object> m = (Map<String, Object>) old;
@@ -249,6 +249,7 @@ public class MemoryDocumentStore impleme
                 break;
             }
             case REMOVE_MAP_ENTRY: {
+                String[] kv = splitInTwo(k, '.');
                 Object old = target.get(kv[0]);
                 @SuppressWarnings("unchecked")
                 Map<String, Object> m = (Map<String, Object>) old;
@@ -258,6 +259,7 @@ public class MemoryDocumentStore impleme
                 break;
             }
             case SET_MAP: {
+                String[] kv = splitInTwo(k, '.');
                 Object old = target.get(kv[0]);
                 @SuppressWarnings("unchecked")
                 Map<String, Object> m = (Map<String, Object>) old;
@@ -274,6 +276,14 @@ public class MemoryDocumentStore impleme
             }
         }
     }
+    
+    private static String[] splitInTwo(String s, char separator) {
+        int index = s.indexOf(separator);
+        if (index < 0) {
+            return new String[] { s };
+        }
+        return new String[] { s.substring(0, index), s.substring(index + 1) };
+    }
 
     @Override
     public boolean create(Collection collection, List<UpdateOp> updateOps) {



Mime
View raw message