diff --git a/server/src/main/java/org/apache/druid/segment/handoff/CoordinatorBasedSegmentHandoffNotifier.java b/server/src/main/java/org/apache/druid/segment/handoff/CoordinatorBasedSegmentHandoffNotifier.java index 09a55003662..4e4b4debc9c 100644 --- a/server/src/main/java/org/apache/druid/segment/handoff/CoordinatorBasedSegmentHandoffNotifier.java +++ b/server/src/main/java/org/apache/druid/segment/handoff/CoordinatorBasedSegmentHandoffNotifier.java @@ -26,6 +26,7 @@ import org.apache.druid.java.util.common.concurrent.Execs; import org.apache.druid.java.util.common.logger.Logger; import org.apache.druid.query.SegmentDescriptor; import org.apache.druid.server.coordination.DruidServerMetadata; +import org.joda.time.Duration; import java.util.Iterator; import java.util.List; @@ -43,7 +44,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot private final ConcurrentMap> handOffCallbacks = new ConcurrentHashMap<>(); private final CoordinatorClient coordinatorClient; private volatile ScheduledExecutorService scheduledExecutor; - private final long pollDurationMillis; + private final Duration pollDuration; private final String dataSource; public CoordinatorBasedSegmentHandoffNotifier( @@ -54,7 +55,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot { this.dataSource = dataSource; this.coordinatorClient = coordinatorClient; - this.pollDurationMillis = config.getPollDuration().getMillis(); + this.pollDuration = config.getPollDuration(); } @Override @@ -80,7 +81,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot { checkForSegmentHandoffs(); } - }, 0L, pollDurationMillis, TimeUnit.MILLISECONDS + }, 0L, pollDuration.getMillis(), TimeUnit.MILLISECONDS ); } @@ -114,10 +115,10 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot catch (Exception e) { log.error( e, - "Exception while checking handoff for dataSource[%s] Segment[%s], Will try again after [%d]secs", + "Exception while checking handoff for dataSource[%s] Segment[%s]; will try again after [%s]", dataSource, descriptor, - pollDurationMillis + pollDuration ); } } @@ -128,9 +129,9 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot catch (Throwable t) { log.error( t, - "Exception while checking handoff for dataSource[%s], Will try again after [%d]secs", + "Exception while checking handoff for dataSource[%s]; will try again after [%s]", dataSource, - pollDurationMillis + pollDuration ); } }