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 20b13d109a)
This commit is contained in:
Masatake Iwasaki 2016-06-14 19:20:46 +09:00
parent 3bf5379adb
commit 3c9d31c55a
2 changed files with 5 additions and 1 deletions

View File

@ -2469,7 +2469,7 @@ protected Server(String bindAddress, int port,
this.maxDataLength = conf.getInt(CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH, this.maxDataLength = conf.getInt(CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH,
CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH_DEFAULT); CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH_DEFAULT);
if (queueSizePerHandler != -1) { if (queueSizePerHandler != -1) {
this.maxQueueSize = queueSizePerHandler; this.maxQueueSize = handlerCount * queueSizePerHandler;
} else { } else {
this.maxQueueSize = handlerCount * conf.getInt( this.maxQueueSize = handlerCount * conf.getInt(
CommonConfigurationKeys.IPC_SERVER_HANDLER_QUEUE_SIZE_KEY, CommonConfigurationKeys.IPC_SERVER_HANDLER_QUEUE_SIZE_KEY,

View File

@ -348,6 +348,10 @@ public void testConfRpc() throws IOException {
assertEquals(3, server.getNumReaders()); assertEquals(3, server.getNumReaders());
assertEquals(200, server.getMaxQueueSize()); assertEquals(200, server.getMaxQueueSize());
server = newServerBuilder(conf).setQueueSizePerHandler(10)
.setNumHandlers(2).setVerbose(false).build();
assertEquals(2 * 10, server.getMaxQueueSize());
} }
@Test @Test