Author: thomasm
Date: Thu Dec 22 14:19:56 2016
New Revision: 1775662

URL: http://svn.apache.org/viewvc?rev=1775662&view=rev
Log:
OAK-2821 PersistentCache not used for RDBBlobStore

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1775662&r1=1775661&r2=1775662&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
 Thu Dec 22 14:19:56 2016
@@ -658,16 +658,20 @@ public class DocumentMK {
 
             if (this.blobStore == null) {
                 GarbageCollectableBlobStore s = new MongoBlobStore(db, 
blobCacheSizeMB * 1024 * 1024L);
-                configureBlobStore(s);
-                PersistentCache p = getPersistentCache();
-                if (p != null) {
-                    s = p.wrapBlobStore(s);
-                }
-                this.blobStore = s;
+                setBlobStore(s);
             }
             return this;
         }
 
+        private void setBlobStore(GarbageCollectableBlobStore s) {
+            configureBlobStore(s);
+            PersistentCache p = getPersistentCache();
+            if (p != null) {
+                s = p.wrapBlobStore(s);
+            }
+            this.blobStore = s;
+        }
+
         /**
          * Use the given MongoDB as backend storage for the DocumentNodeStore.
          *
@@ -717,9 +721,9 @@ public class DocumentMK {
          */
         public Builder setRDBConnection(DataSource ds, RDBOptions options) {
             this.documentStore = new RDBDocumentStore(ds, this, options);
-            if(this.blobStore == null) {
-                this.blobStore = new RDBBlobStore(ds, options);
-                configureBlobStore(blobStore);
+            if(blobStore == null) {
+                GarbageCollectableBlobStore s = new RDBBlobStore(ds, options);
+                setBlobStore(s);
             }
             return this;
         }
@@ -732,8 +736,10 @@ public class DocumentMK {
          */
         public Builder setRDBConnection(DataSource documentStoreDataSource, 
DataSource blobStoreDataSource) {
             this.documentStore = new RDBDocumentStore(documentStoreDataSource, 
this);
-            this.blobStore = new RDBBlobStore(blobStoreDataSource);
-            configureBlobStore(blobStore);
+            if(blobStore == null) {
+                GarbageCollectableBlobStore s = new 
RDBBlobStore(blobStoreDataSource);
+                setBlobStore(s);
+            }
             return this;
         }
 


Reply via email to