jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1421881 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: JsopDiff.java KernelBlob.java
Date Fri, 14 Dec 2012 14:19:28 GMT
Author: mduerig
Date: Fri Dec 14 14:19:27 2012
New Revision: 1421881

URL: http://svn.apache.org/viewvc?rev=1421881&view=rev
Log:
OAK-518: Avoid streaming binaries to the Microkernel which are already there

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java?rev=1421881&r1=1421880&r2=1421881&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/JsopDiff.java
Fri Dec 14 14:19:27 2012
@@ -153,10 +153,15 @@ class JsopDiff implements NodeStateDiff 
                 break;
             case PropertyType.BINARY:
                 for (Blob value : property.getValue(BINARIES)) {
-                    InputStream is = value.getNewStream();
-                    String binId = TypeCodes.encode(type, kernel.write(is));
-                    close(is);
-                    jsop.value(binId);
+                    String binId;
+                    if (value instanceof KernelBlob) {
+                        binId = ((KernelBlob) value).getBinaryID();
+                    } else {
+                        InputStream is = value.getNewStream();
+                        binId = kernel.write(is);
+                        close(is);
+                    }
+                    jsop.value(TypeCodes.encode(type, binId));
                 }
                 break;
             default:

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java?rev=1421881&r1=1421880&r2=1421881&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBlob.java
Fri Dec 14 14:19:27 2012
@@ -33,6 +33,14 @@ public class KernelBlob extends Abstract
     private final MicroKernel kernel;
 
     /**
+     * The id returned from {@link MicroKernel#write(java.io.InputStream)}
+     * @return  the binary id of this blob
+     */
+    public String getBinaryID() {
+        return binaryID;
+    }
+
+    /**
      * Create a new instance for a binary id and a Microkernel.
      * @param binaryID  id of the binary
      * @param kernel



Mime
View raw message