hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [2/4] hbase git commit: HBASE-19708 Avoid NPE when the RPC listener's accept channel is closed
Date Fri, 05 Jan 2018 19:26:54 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/b528cd01
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b528cd01
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b528cd01

Branch: refs/heads/branch-1
Commit: b528cd01b7b41c93e711c023acfb0722e0d9068c
Parents: b5ec4d3
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:03 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/b528cd01/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 3000622..bc3b33a 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
@@ -206,6 +206,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
@@ -657,6 +658,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();
 
@@ -888,7 +891,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
     }
 
     InetSocketAddress getAddress() {
-      return (InetSocketAddress)acceptChannel.socket().getLocalSocketAddress();
+      return address;
     }
 
     void doAccept(SelectionKey key) throws IOException, OutOfMemoryError {
@@ -2197,7 +2200,6 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
 
     this.cellBlockBuilder = new CellBlockBuilder(conf);
 
-
     // Create the responder here
     responder = new Responder();
     this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);


Mime
View raw message