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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git

commit ce20baf6033cc123f9732de59ec09d83bb4ddd43
Author: Gary Gregory <[email protected]>
AuthorDate: Wed May 10 12:09:57 2023 -0400

    Setting builder delay duration to null acts as a reset.
---
 src/main/java/org/apache/commons/io/input/Tailer.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/input/Tailer.java 
b/src/main/java/org/apache/commons/io/input/Tailer.java
index a8339705..1693b0a1 100644
--- a/src/main/java/org/apache/commons/io/input/Tailer.java
+++ b/src/main/java/org/apache/commons/io/input/Tailer.java
@@ -175,6 +175,8 @@ public class Tailer implements Runnable, AutoCloseable {
      */
     public static class Builder extends AbstractStreamBuilder<Tailer, Builder> 
{
 
+        private static final Duration DEFAULT_DELAY_DURATION = 
Duration.ofMillis(DEFAULT_DELAY_MILLIS);
+
         /**
          * Creates a new daemon thread.
          *
@@ -189,7 +191,7 @@ public class Tailer implements Runnable, AutoCloseable {
 
         private Tailable tailable;
         private TailerListener tailerListener;
-        private Duration delayDuration = 
Duration.ofMillis(DEFAULT_DELAY_MILLIS);
+        private Duration delayDuration = DEFAULT_DELAY_DURATION;
         private boolean end;
         private boolean reOpen;
         private boolean startThread = true;
@@ -212,13 +214,13 @@ public class Tailer implements Runnable, AutoCloseable {
         }
 
         /**
-         * Sets the delay duration.
+         * Sets the delay duration. null resets to the default delay of one 
second.
          *
          * @param delayDuration the delay between checks of the file for new 
content.
          * @return this
          */
         public Builder setDelayDuration(final Duration delayDuration) {
-            this.delayDuration = Objects.requireNonNull(delayDuration, 
"delayDuration");
+            this.delayDuration = delayDuration != null ? delayDuration : 
DEFAULT_DELAY_DURATION;
             return this;
         }
 
@@ -229,7 +231,7 @@ public class Tailer implements Runnable, AutoCloseable {
          * @return this
          */
         public Builder setExecutorService(final ExecutorService 
executorService) {
-            this.executorService = executorService;
+            this.executorService = Objects.requireNonNull(executorService, 
"executorService");;
             return this;
         }
 

Reply via email to