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 2022/12/21 14:07:26 UTC
[jackrabbit-oak] branch 1.22 updated: OAK-9019: use SystemPropertySupplier in RDBMissingLastRevSeeker
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
The following commit(s) were added to refs/heads/1.22 by this push:
new 3c97bd3f66 OAK-9019: use SystemPropertySupplier in RDBMissingLastRevSeeker
3c97bd3f66 is described below
commit 3c97bd3f663adc8f5aa716c47f94d6d0b3080ab3
Author: Julian Reschke <re...@apache.org>
AuthorDate: Mon Apr 20 10:14:42 2020 +0000
OAK-9019: use SystemPropertySupplier in RDBMissingLastRevSeeker
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1876750 13f79535-47bb-0310-9956-ffa450edef68
---
.../document/rdb/RDBMissingLastRevSeeker.java | 32 ++++------------------
1 file changed, 6 insertions(+), 26 deletions(-)
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
index 799954c5d0..8e99645595 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.oak.plugins.document.Collection;
import org.apache.jackrabbit.oak.plugins.document.MissingLastRevSeeker;
import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.QueryCondition;
+import org.apache.jackrabbit.oak.plugins.document.util.SystemPropertySupplier;
import org.apache.jackrabbit.oak.stats.Clock;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
@@ -40,34 +41,13 @@ public class RDBMissingLastRevSeeker extends MissingLastRevSeeker {
// 1: seek using historical, paging mode
// 2: use custom single query directly using RDBDocumentStore API
- private static final int MODE;
-
private static final int DEFAULTMODE = 2;
- static {
- String propName = "org.apache.jackrabbit.oak.plugins.document.rdb.RDBMissingLastRevSeeker.MODE";
- String value = System.getProperty(propName, "");
- switch (value) {
- case "":
- MODE = DEFAULTMODE;
- break;
- case "1":
- MODE = 1;
- break;
- case "2":
- MODE = 2;
- break;
- default:
- LOG.error("Ignoring unexpected value '" + value + "' for system property " + propName);
- MODE = DEFAULTMODE;
- break;
- }
-
- if (DEFAULTMODE != MODE) {
- LOG.info("Strategy for " + RDBMissingLastRevSeeker.class.getName() + " set to " + MODE + " (via system property "
- + propName + ")");
- }
- }
+ private static final int MODE = SystemPropertySupplier.create(RDBMissingLastRevSeeker.class.getName() + ".MODE", DEFAULTMODE)
+ .loggingTo(LOG).validateWith(value -> (value == 1 || value == 2)).formatSetMessage((name, value) -> {
+ return String.format("Strategy for %s set to %s (via system property %s)", RDBMissingLastRevSeeker.class.getName(),
+ name, value);
+ }).get();
private final RDBDocumentStore store;