List of usage examples for org.apache.hadoop.ipc RPC getProxy
public static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException
From source file:com.datatorrent.stram.RecoverableRpcProxy.java
License:Apache License
private void connect() throws IOException { FSRecoveryHandler fsrh = new FSRecoveryHandler(appPath, conf); String uriStr = fsrh.readConnectUri(); if (!uriStr.equals(lastConnectURI)) { // reset timeout LOG.debug("Got new RPC connect address {}", uriStr); lastCompletedCallTms = System.currentTimeMillis(); lastConnectURI = uriStr;/*from ww w . j a va2 s. c om*/ } URI heartbeatUri = URI.create(uriStr); String queryStr = heartbeatUri.getQuery(); List<NameValuePair> queryList = null; if (queryStr != null) { queryList = URLEncodedUtils.parse(queryStr, Charset.defaultCharset()); } if (queryList != null) { for (NameValuePair pair : queryList) { String value = pair.getValue(); String key = pair.getName(); if (QP_rpcTimeout.equals(key)) { this.rpcTimeout = Integer.parseInt(value); } else if (QP_retryTimeoutMillis.equals(key)) { this.retryTimeoutMillis = Long.parseLong(value); } else if (QP_retryDelayMillis.equals(key)) { this.retryDelayMillis = Long.parseLong(value); } } } InetSocketAddress address = NetUtils.createSocketAddrForHost(heartbeatUri.getHost(), heartbeatUri.getPort()); umbilical = RPC.getProxy(StreamingContainerUmbilicalProtocol.class, StreamingContainerUmbilicalProtocol.versionID, address, UserGroupInformation.getCurrentUser(), conf, NetUtils.getDefaultSocketFactory(conf), rpcTimeout); }