Example usage for org.apache.hadoop.ipc Server getMaxQueueSize

List of usage examples for org.apache.hadoop.ipc Server getMaxQueueSize

Introduction

In this page you can find the example usage for org.apache.hadoop.ipc Server getMaxQueueSize.

Prototype

public int getMaxQueueSize() 

Source Link

Document

The maximum size of the rpc call queue of this server.

Usage

From source file:rpc.TestRPC.java

License:Apache License

@Test
public void testConfRpc() throws IOException {
    Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class).setInstance(new TestImpl())
            .setBindAddress(ADDRESS).setPort(0).setNumHandlers(1).setVerbose(false).build();
    // Just one handler
    int confQ = conf.getInt(CommonConfigurationKeys.IPC_SERVER_HANDLER_QUEUE_SIZE_KEY,
            CommonConfigurationKeys.IPC_SERVER_HANDLER_QUEUE_SIZE_DEFAULT);
    assertEquals(confQ, server.getMaxQueueSize());

    int confReaders = conf.getInt(CommonConfigurationKeys.IPC_SERVER_RPC_READ_THREADS_KEY,
            CommonConfigurationKeys.IPC_SERVER_RPC_READ_THREADS_DEFAULT);
    assertEquals(confReaders, server.getNumReaders());
    server.stop();/* w  ww .  j  a va 2 s.  co  m*/

    server = new RPC.Builder(conf).setProtocol(TestProtocol.class).setInstance(new TestImpl())
            .setBindAddress(ADDRESS).setPort(0).setNumHandlers(1).setnumReaders(3).setQueueSizePerHandler(200)
            .setVerbose(false).build();

    assertEquals(3, server.getNumReaders());
    assertEquals(200, server.getMaxQueueSize());
    server.stop();
}