|
@@ -40,6 +40,7 @@ import javax.net.SocketFactory;
|
|
|
import org.apache.commons.logging.*;
|
|
|
|
|
|
import org.apache.hadoop.HadoopIllegalArgumentException;
|
|
|
+import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
|
import org.apache.hadoop.io.*;
|
|
|
import org.apache.hadoop.io.retry.RetryPolicy;
|
|
|
import org.apache.hadoop.ipc.Client.ConnectionId;
|
|
@@ -343,7 +344,8 @@ public class RPC {
|
|
|
long clientVersion,
|
|
|
InetSocketAddress addr, Configuration conf,
|
|
|
long connTimeout) throws IOException {
|
|
|
- return waitForProtocolProxy(protocol, clientVersion, addr, conf, 0, null, connTimeout);
|
|
|
+ return waitForProtocolProxy(protocol, clientVersion, addr, conf,
|
|
|
+ getRpcTimeout(conf), null, connTimeout);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -487,8 +489,8 @@ public class RPC {
|
|
|
UserGroupInformation ticket,
|
|
|
Configuration conf,
|
|
|
SocketFactory factory) throws IOException {
|
|
|
- return getProtocolProxy(
|
|
|
- protocol, clientVersion, addr, ticket, conf, factory, 0, null);
|
|
|
+ return getProtocolProxy(protocol, clientVersion, addr, ticket, conf,
|
|
|
+ factory, getRpcTimeout(conf), null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -682,6 +684,17 @@ public class RPC {
|
|
|
+ "does not provide closeable invocation handler "
|
|
|
+ proxy.getClass());
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Get the RPC time from configuration;
|
|
|
+ * If not set in the configuration, return the default value.
|
|
|
+ *
|
|
|
+ * @param conf Configuration
|
|
|
+ * @return the RPC timeout (ms)
|
|
|
+ */
|
|
|
+ public static int getRpcTimeout(Configuration conf) {
|
|
|
+ return conf.getInt(CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_KEY,
|
|
|
+ CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_DEFAULT);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Class to construct instances of RPC server with specific options.
|