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 st...@apache.org on 2016/07/07 15:45:21 UTC

svn commit: r1751811 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java

Author: stefanegli
Date: Thu Jul  7 15:45:21 2016
New Revision: 1751811

URL: http://svn.apache.org/viewvc?rev=1751811&view=rev
Log:
OAK-4533: make DELAY_THRESHOLD and MAX_DELAY adjustable - using System.properties for now

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java?rev=1751811&r1=1751810&r2=1751811&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java Thu Jul  7 15:45:21 2016
@@ -82,14 +82,40 @@ class ChangeProcessor implements Observe
      * Fill ratio of the revision queue at which commits should be delayed
      * (conditional of {@code commitRateLimiter} being non {@code null}).
      */
-    public static final double DELAY_THRESHOLD = 0.8;
+    public static final double DELAY_THRESHOLD;
 
     /**
      * Maximal number of milli seconds a commit is delayed once {@code DELAY_THRESHOLD}
      * kicks in.
      */
-    public static final int MAX_DELAY = 10000;
+    public static final int MAX_DELAY;
 
+    // OAK-4533: make DELAY_THRESHOLD and MAX_DELAY adjustable - using System.properties for now
+    static {
+        final String delayThresholdStr = System.getProperty("oak.commitRateLimiter.delayThreshold");
+        final String maxDelayStr = System.getProperty("oak.commitRateLimiter.maxDelay");
+        double delayThreshold = 0.8; /* default is 0.8 still */
+        int maxDelay = 10000; /* default is 10000 still */
+        try{
+            if (delayThresholdStr != null && delayThresholdStr.length() != 0) {
+                delayThreshold = Double.parseDouble(delayThresholdStr);
+                LOG.info("<clinit> using oak.commitRateLimiter.delayThreshold of " + delayThreshold);
+            }
+        } catch(RuntimeException e) {
+            LOG.warn("<clinit> could not parse oak.commitRateLimiter.delayThreshold, using default(" + delayThreshold + "): " + e, e);
+        }
+        try{
+            if (maxDelayStr != null && maxDelayStr.length() != 0) {
+                maxDelay = Integer.parseInt(maxDelayStr);
+                LOG.info("<clinit> using oak.commitRateLimiter.maxDelay of " + maxDelay + "ms");
+            }
+        } catch(RuntimeException e) {
+            LOG.warn("<clinit> could not parse oak.commitRateLimiter.maxDelay, using default(" + maxDelay + "): " + e, e);
+        }
+        DELAY_THRESHOLD = delayThreshold;
+        MAX_DELAY = maxDelay;
+    }
+    
     private static final AtomicInteger COUNTER = new AtomicInteger();
 
     /**