hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/4] hbase git commit: HBASE-19708 Avoid NPE when the RPC listener's accept channel is closed
Date Fri, 05 Jan 2018 19:26:55 GMT
HBASE-19708 Avoid NPE when the RPC listener's accept channel is closed


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/09b32ca3
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/09b32ca3
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/09b32ca3

Branch: refs/heads/branch-1.3
Commit: 09b32ca380af8fd63f665b01270a1227978b0c2f
Parents: aded33e
Author: Andrew Purtell <apurtell@apache.org>
Authored: Thu Jan 4 15:57:32 2018 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Jan 5 09:58:25 2018 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/09b32ca3/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index c0ea148..ab42538 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -215,6 +215,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
 
   protected final InetSocketAddress bindAddress;
   protected int port;                             // port we listen on
+  protected InetSocketAddress address;            // inet address we listen on
   private int readThreads;                        // number of read threads
   protected int maxIdleTime;                      // the maximum idle time after
                                                   // which a client may be
@@ -660,6 +661,8 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
       // Bind the server socket to the binding addrees (can be different from the default
interface)
       bind(acceptChannel.socket(), bindAddress, backlogLength);
       port = acceptChannel.socket().getLocalPort(); //Could be an ephemeral port
+      address = (InetSocketAddress)acceptChannel.socket().getLocalSocketAddress();
+
       // create a selector;
       selector= Selector.open();
 
@@ -890,7 +893,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
     }
 
     InetSocketAddress getAddress() {
-      return (InetSocketAddress)acceptChannel.socket().getLocalSocketAddress();
+      return address;
     }
 
     void doAccept(SelectionKey key) throws IOException, OutOfMemoryError {
@@ -2192,7 +2195,6 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
 
     this.ipcUtil = new IPCUtil(conf);
 
-
     // Create the responder here
     responder = new Responder();
     this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);


Mime
View raw message