jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1538973 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk: MongoBlob.java MongoNodeStoreBranch.java
Date Tue, 05 Nov 2013 12:46:09 GMT
Author: thomasm
Date: Tue Nov  5 12:46:09 2013
New Revision: 1538973

URL: http://svn.apache.org/r1538973
Log:
OAK-1080: MongoMK: improved concurrency

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoBlob.java?rev=1538973&r1=1538972&r2=1538973&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoBlob.java
Tue Nov  5 12:46:09 2013
@@ -57,4 +57,23 @@ public class MongoBlob implements Blob {
         return id;
     }
     
+    @Override
+    public int hashCode() {
+        return id.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        } 
+        if (other instanceof MongoBlob) {
+            MongoBlob b = (MongoBlob) other;
+            // theoretically, the data could be the same  
+            // even if the id is different
+            return b.id.equals(id);
+        }
+        return false;
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStoreBranch.java?rev=1538973&r1=1538972&r2=1538973&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStoreBranch.java
Tue Nov  5 12:46:09 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.mongomk;
 
+import java.io.IOException;
+
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.kernel.BlobSerializer;
 import org.apache.jackrabbit.oak.plugins.observation.ChangeDispatcher;
@@ -31,7 +33,16 @@ public class MongoNodeStoreBranch
     private final BlobSerializer blobs = new BlobSerializer() {
         @Override
         public String serialize(Blob blob) {
-            return blob.toString();
+            if (blob instanceof MongoBlob) {
+                return blob.toString();
+            }
+            String id;
+            try {
+                id = store.createBlob(blob.getNewStream()).toString();
+            } catch (IOException e) {
+                throw new IllegalStateException(e);
+            }
+            return id;
         }
     };
 



Mime
View raw message