Skip to content

Commit

Permalink
Reduce flakiness of ReplicatorTest.testConfigChange (apache#10116)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari authored Apr 2, 2021
1 parent 21adedc commit e1e2e53
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public class ReplicatorTestBase extends TestRetrySupport {

ZookeeperServerTest globalZkS;

ExecutorService executor = new ThreadPoolExecutor(5, 20, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
new DefaultThreadFactory("ReplicatorTestBase"));
ExecutorService executor;

static final int TIME_TO_CHECK_BACKLOG_QUOTA = 5;

Expand All @@ -104,6 +103,9 @@ protected void setup() throws Exception {
incrementSetupNumber();

log.info("--- Starting ReplicatorTestBase::setup ---");
executor = new ThreadPoolExecutor(5, 20, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
new DefaultThreadFactory("ReplicatorTestBase"));

globalZkS = new ZookeeperServerTest(0);
globalZkS.start();

Expand Down Expand Up @@ -266,7 +268,10 @@ private int inSec(int time, TimeUnit unit) {
protected void cleanup() throws Exception {
markCurrentSetupNumberCleaned();
log.info("--- Shutting down ---");
executor.shutdown();
if (executor != null) {
executor.shutdown();
executor = null;
}

admin1.close();
admin2.close();
Expand Down

0 comments on commit e1e2e53

Please sign in to comment.