HADOOP-13244. o.a.h.ipc.Server#Server should honor handlerCount when queueSizePerHandler is specified in consturctor. Contributed by Kai Sasaki.

This commit is contained in:
Masatake Iwasaki 2016-06-14 19:20:46 +09:00
parent ee55b74fb9
commit 20b13d109a
2 changed files with 5 additions and 1 deletions

View File

@ -2553,7 +2553,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,

View File

@ -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