From 923c003213477ffc5ebf46c880edbb691d1aa816 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Wed, 27 Nov 2019 19:30:09 -0800 Subject: [PATCH] add flush timeout to emitter test (#8963) --- .../druid/java/util/emitter/core/HttpEmitterConfig.java | 6 ++++++ .../apache/druid/java/util/emitter/core/EmitterTest.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/core/src/main/java/org/apache/druid/java/util/emitter/core/HttpEmitterConfig.java b/core/src/main/java/org/apache/druid/java/util/emitter/core/HttpEmitterConfig.java index 9e92f924514..91afe071e23 100644 --- a/core/src/main/java/org/apache/druid/java/util/emitter/core/HttpEmitterConfig.java +++ b/core/src/main/java/org/apache/druid/java/util/emitter/core/HttpEmitterConfig.java @@ -81,6 +81,12 @@ public class HttpEmitterConfig extends BaseHttpEmittingConfig return this; } + public Builder setFlushTimeout(long flushTimeout) + { + this.flushTimeOut = flushTimeout; + return this; + } + public Builder setFlushCount(int flushCount) { this.flushCount = flushCount; diff --git a/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java b/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java index f93270ba033..47a724c48fd 100644 --- a/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java +++ b/core/src/test/java/org/apache/druid/java/util/emitter/core/EmitterTest.java @@ -52,6 +52,7 @@ import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; @@ -117,6 +118,7 @@ public class EmitterTest { HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL) .setFlushMillis(timeInMillis) + .setFlushTimeout(TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS)) .setFlushCount(Integer.MAX_VALUE) .build(); HttpPostEmitter emitter = new HttpPostEmitter( @@ -132,6 +134,7 @@ public class EmitterTest { HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL) .setFlushMillis(Long.MAX_VALUE) + .setFlushTimeout(TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS)) .setFlushCount(size) .build(); HttpPostEmitter emitter = new HttpPostEmitter(