You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2023/01/02 07:07:08 UTC

[jackrabbit-oak] 01/02: OAK-9031: use SystemPropertySupplier in DocumentNodeStore

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch 1.22
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit d8d26ab740b6396542d0bdbd553c25f8e11234c6
Author: Julian Reschke <re...@apache.org>
AuthorDate: Fri Apr 24 07:33:47 2020 +0000

    OAK-9031: use SystemPropertySupplier in DocumentNodeStore
    
    git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1876916 13f79535-47bb-0310-9956-ffa450edef68
---
 .../oak/plugins/document/DocumentNodeStore.java    | 35 +++++++++++-----------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
index 1b0d21b1c7..2c99954e60 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
@@ -93,6 +93,7 @@ import org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlor;
 import org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache;
 import org.apache.jackrabbit.oak.plugins.document.persistentCache.broadcast.DynamicBroadcastConfig;
 import org.apache.jackrabbit.oak.plugins.document.util.ReadOnlyDocumentStoreWrapperFactory;
+import org.apache.jackrabbit.oak.plugins.document.util.SystemPropertySupplier;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.commons.json.JsopStream;
 import org.apache.jackrabbit.oak.commons.json.JsopWriter;
@@ -162,46 +163,47 @@ public final class DocumentNodeStore
     /**
      * Enable fast diff operations.
      */
-    private static final boolean FAST_DIFF = Boolean.parseBoolean(
-            System.getProperty("oak.documentMK.fastDiff", "true"));
+    private static final boolean FAST_DIFF = SystemPropertySupplier.create("oak.documentMK.fastDiff", Boolean.TRUE).loggingTo(LOG)
+            .get();
 
     /**
      * Feature flag to enable concurrent add/remove operations of hidden empty
      * nodes. See OAK-2673.
      */
-    private boolean enableConcurrentAddRemove =
-            Boolean.getBoolean("oak.enableConcurrentAddRemove");
+    private boolean enableConcurrentAddRemove = SystemPropertySupplier.create("oak.enableConcurrentAddRemove", Boolean.FALSE)
+            .loggingTo(LOG).get();
 
     /**
      * Use fair mode for background operation lock.
      */
-    private boolean fairBackgroundOperationLock =
-            Boolean.parseBoolean(System.getProperty("oak.fairBackgroundOperationLock", "true"));
+    private boolean fairBackgroundOperationLock = SystemPropertySupplier.create("oak.fairBackgroundOperationLock", Boolean.TRUE)
+            .loggingTo(LOG).get();
 
     public static final String SYS_PROP_DISABLE_JOURNAL = "oak.disableJournalDiff";
     /**
      * Feature flag to disable the journal diff mechanism. See OAK-4528.
      */
-    private boolean disableJournalDiff =
-            Boolean.getBoolean(SYS_PROP_DISABLE_JOURNAL);
+    private boolean disableJournalDiff = SystemPropertySupplier.create(SYS_PROP_DISABLE_JOURNAL, Boolean.FALSE).loggingTo(LOG)
+            .get();
 
     /**
      * Threshold for number of paths in journal entry to require a force push during commit
      * (instead of at background write)
      */
-    private int journalPushThreshold = Integer.getInteger("oak.journalPushThreshold", 100000);
+    private int journalPushThreshold = SystemPropertySupplier.create("oak.journalPushThreshold", 100000).loggingTo(LOG).get();
 
     /**
      * How many collision entries to collect in a single call.
      */
-    private int collisionGarbageBatchSize = Integer.getInteger("oak.documentMK.collisionGarbageBatchSize", 1000);
+    private int collisionGarbageBatchSize = SystemPropertySupplier.create("oak.documentMK.collisionGarbageBatchSize", 1000)
+            .loggingTo(LOG).get();
 
     /**
      * The number of updates to batch with a single call to
      * {@link DocumentStore#createOrUpdate(Collection, List)}.
      */
-    private final int createOrUpdateBatchSize =
-            Integer.getInteger("oak.documentMK.createOrUpdateBatchSize", 1000);
+    private final int createOrUpdateBatchSize = SystemPropertySupplier.create("oak.documentMK.createOrUpdateBatchSize", 1000)
+            .loggingTo(LOG).get();
 
     public static final String SYS_PROP_DISABLE_SWEEP2 = "oak.documentMK.disableSweep2";
     private boolean disableSweep2 = SystemPropertySupplier.create(SYS_PROP_DISABLE_SWEEP2, Boolean.FALSE).loggingTo(LOG)
@@ -247,12 +249,11 @@ public final class DocumentNodeStore
      * The maximum back off time in milliseconds when merges are retried. The
      * default value is twice the {@link #asyncDelay}.
      */
-    private int maxBackOffMillis =
-            Integer.getInteger("oak.maxBackOffMS", asyncDelay * 2);
+    private int maxBackOffMillis = SystemPropertySupplier.create("oak.maxBackOffMS", asyncDelay * 2).loggingTo(LOG).get();
 
-    private int changeSetMaxItems =  Integer.getInteger("oak.document.changeSet.maxItems", 50);
+    private int changeSetMaxItems = SystemPropertySupplier.create("oak.document.changeSet.maxItems", 50).loggingTo(LOG).get();
 
-    private int changeSetMaxDepth =  Integer.getInteger("oak.document.changeSet.maxDepth", 9);
+    private int changeSetMaxDepth = SystemPropertySupplier.create("oak.document.changeSet.maxDepth", 9).loggingTo(LOG).get();
 
     /**
      * Whether this instance is disposed.
@@ -570,7 +571,7 @@ public final class DocumentNodeStore
         this.clock = builder.getClock();
 
         int cid = builder.getClusterId();
-        cid = Integer.getInteger("oak.documentMK.clusterId", cid);
+        cid = SystemPropertySupplier.create("oak.documentMK.clusterId", cid).loggingTo(LOG).get();
         if (readOnlyMode) {
             clusterNodeInfo = ClusterNodeInfo.getReadOnlyInstance(nonLeaseCheckingStore);
         } else {