Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1602#discussion_r145973529
  
    --- Diff: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
 ---
    @@ -34,6 +34,25 @@
     import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
     
     public final class TimedBuffer {
    +
    +   /**
    +    * Property name to set the percentage of error allowed while expiring 
the flush {@code timeout} to happen:
    +    * it can assume any positive value from {@code 0} to {@link 
Integer#MAX_VALUE}.
    +    * <p>
    +    * By default it is {@link #DEFAULT_TIMEOUT_ERROR_PERCENTAGE} more than 
the configured {@code timeout}.
    +    */
    +   public static final String JOURNAL_TIMEOUT_ERROR_PROPERTY_NAME = 
"journal.timeout.error";
    +   public static final int DEFAULT_TIMEOUT_ERROR_PERCENTAGE = 50;
    +   private static final double MAX_TIMEOUT_ERROR;
    +
    +   static {
    +      final int errorPercentage = 
Integer.getInteger(JOURNAL_TIMEOUT_ERROR_PROPERTY_NAME, 
DEFAULT_TIMEOUT_ERROR_PERCENTAGE);
    +      if (errorPercentage < 0) {
    +         throw new RuntimeException("The sleep error percentage must be >= 
0");
    +      }
    +      MAX_TIMEOUT_ERROR = 1 + (errorPercentage / 100);
    --- End diff --
    
    In the old code was indeed:
    ```
                   // I'm letting the real time to be up to 50% than the 
requested sleep.
                   if (realTimeSleep > timeout * 1.5) {
                      failedChecks++;
                   }
    ```


---

Reply via email to