List of usage examples for org.apache.hadoop.fs CommonConfigurationKeys IPC_CLIENT_RPC_TIMEOUT_KEY
String IPC_CLIENT_RPC_TIMEOUT_KEY
To view the source code for org.apache.hadoop.fs CommonConfigurationKeys IPC_CLIENT_RPC_TIMEOUT_KEY.
Click Source Link
From source file:rpc.TestRPC.java
License:Apache License
/** * Test RPC timeout.//from ww w. jav a 2 s . c om */ @Test(timeout = 30000) public void testClientRpcTimeout() throws Exception { final Server server = new RPC.Builder(conf).setProtocol(TestProtocol.class).setInstance(new TestImpl()) .setBindAddress(ADDRESS).setPort(0).setQueueSizePerHandler(1).setNumHandlers(1).setVerbose(true) .build(); server.start(); final Configuration conf = new Configuration(); conf.setInt(CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_KEY, 1000); final TestProtocol proxy = RPC.getProxy(TestProtocol.class, TestProtocol.versionID, NetUtils.getConnectAddress(server), conf); try { proxy.sleep(3000); fail("RPC should time out."); } catch (SocketTimeoutException e) { LOG.info("got expected timeout.", e); } finally { server.stop(); RPC.stopProxy(proxy); } }