Example usage for org.apache.hadoop.fs CommonConfigurationKeys IPC_PING_INTERVAL_KEY

List of usage examples for org.apache.hadoop.fs CommonConfigurationKeys IPC_PING_INTERVAL_KEY

Introduction

In this page you can find the example usage for org.apache.hadoop.fs CommonConfigurationKeys IPC_PING_INTERVAL_KEY.

Prototype

String IPC_PING_INTERVAL_KEY

To view the source code for org.apache.hadoop.fs CommonConfigurationKeys IPC_PING_INTERVAL_KEY.

Click Source Link

Document

How often does RPC client send pings to RPC server

Usage

From source file:org.apache.storm.hdfs.spout.TestDirLock.java

License:Apache License

@BeforeClass
public static void setupClass() throws IOException {
    conf.set(CommonConfigurationKeys.IPC_PING_INTERVAL_KEY, "5000");
    builder = new MiniDFSCluster.Builder(new Configuration());
    hdfsCluster = builder.build();/*ww w. j a v a  2 s .  c om*/
    fs = hdfsCluster.getFileSystem();
    hdfsURI = "hdfs://localhost:" + hdfsCluster.getNameNodePort() + "/";
}

From source file:rpc.TestRPC.java

License:Apache License

@Test
public void testConnectionPing() throws Exception {
    Configuration conf = new Configuration();
    int pingInterval = 50;
    conf.setBoolean(CommonConfigurationKeys.IPC_CLIENT_PING_KEY, true);
    conf.setInt(CommonConfigurationKeys.IPC_PING_INTERVAL_KEY, pingInterval);
    final Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class).setInstance(new TestImpl())
            .setBindAddress(ADDRESS).setPort(0).setNumHandlers(5).setVerbose(true).build();
    server.start();//from   w  ww.  j  a  v a 2  s.c o m

    final TestProtocol proxy = RPC.getProxy(TestProtocol.class, TestProtocol.versionID,
            server.getListenerAddress(), conf);
    try {
        // this call will throw exception if server couldn't decode the ping
        proxy.sleep(pingInterval * 4);
    } finally {
        if (proxy != null)
            RPC.stopProxy(proxy);
        server.stop();
    }
}