HADOOP-7282. ipc.Server.getRemoteIp() may return null. Contributed by John George

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1104426 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2011-05-17 17:41:14 +00:00
parent 2e6063b006
commit 31a77f91cf
2 changed files with 11 additions and 1 deletions

View File

@ -226,6 +226,9 @@ Trunk (unreleased changes)
HADOOP-7292. Fix racy test case TestSinkQueue. (Luke Lu via todd) HADOOP-7292. Fix racy test case TestSinkQueue. (Luke Lu via todd)
HADOOP-7282. ipc.Server.getRemoteIp() may return null. (John George
via szetszwo)
Release 0.22.0 - Unreleased Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -154,7 +154,7 @@ public static Server get() {
public static InetAddress getRemoteIp() { public static InetAddress getRemoteIp() {
Call call = CurCall.get(); Call call = CurCall.get();
if (call != null) { if (call != null) {
return call.connection.socket.getInetAddress(); return call.connection.getHostInetAddress();
} }
return null; return null;
} }
@ -166,6 +166,13 @@ public static String getRemoteAddress() {
return (addr == null) ? null : addr.getHostAddress(); return (addr == null) ? null : addr.getHostAddress();
} }
/** Return true if the invocation was through an RPC.
*/
public static boolean isRpcInvocation() {
return CurCall.get() != null;
}
private String bindAddress; private String bindAddress;
private int port; // port we listen on private int port; // port we listen on
private int handlerCount; // number of handler threads private int handlerCount; // number of handler threads