From 3c9d31c55a4329f4255598dcb6f7143df03149a0 Mon Sep 17 00:00:00 2001 From: Masatake Iwasaki Date: Tue, 14 Jun 2016 19:20:46 +0900 Subject: [PATCH] HADOOP-13244. o.a.h.ipc.Server#Server should honor handlerCount when queueSizePerHandler is specified in consturctor. Contributed by Kai Sasaki. (cherry picked from commit 20b13d109a1f66d8911936d26bdde38d81a1c4c6) --- .../src/main/java/org/apache/hadoop/ipc/Server.java | 2 +- .../src/test/java/org/apache/hadoop/ipc/TestRPC.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java index bf2b5c5225d..5d3e23ed369 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java @@ -2469,7 +2469,7 @@ public abstract class Server { this.maxDataLength = conf.getInt(CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH, CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH_DEFAULT); if (queueSizePerHandler != -1) { - this.maxQueueSize = queueSizePerHandler; + this.maxQueueSize = handlerCount * queueSizePerHandler; } else { this.maxQueueSize = handlerCount * conf.getInt( CommonConfigurationKeys.IPC_SERVER_HANDLER_QUEUE_SIZE_KEY, diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java index 921216318a1..93c78eca5ff 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java @@ -348,6 +348,10 @@ public class TestRPC extends TestRpcBase { assertEquals(3, server.getNumReaders()); assertEquals(200, server.getMaxQueueSize()); + + server = newServerBuilder(conf).setQueueSizePerHandler(10) + .setNumHandlers(2).setVerbose(false).build(); + assertEquals(2 * 10, server.getMaxQueueSize()); } @Test