From 824f71788239514312dfc58edcccaebaaf606606 Mon Sep 17 00:00:00 2001 From: Tsz Wo Nicholas Sze Date: Mon, 25 Feb 2019 13:15:28 -0800 Subject: [PATCH] HADOOP-16126. ipc.Client.stop() may sleep too long to wait for all connections. (cherry picked from commit 0edb0c51dc2c4ae2f353e260f01912e28033d70f) --- .../src/main/java/org/apache/hadoop/ipc/Client.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java index efd77a0071f..4ea1f4197cd 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java @@ -86,6 +86,7 @@ import static org.apache.hadoop.ipc.RpcConstants.PING_CALL_ID; public class Client implements AutoCloseable { public static final Logger LOG = LoggerFactory.getLogger(Client.class); + private static final int STOP_SLEEP_TIME_MS = 10; /** A counter for generating call IDs. */ private static final AtomicInteger callIdCounter = new AtomicInteger(); @@ -1353,7 +1354,7 @@ public class Client implements AutoCloseable { // wait until all connections are closed while (!connections.isEmpty()) { try { - Thread.sleep(100); + Thread.sleep(STOP_SLEEP_TIME_MS); } catch (InterruptedException e) { } }