hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-14078 improve error message when HMaster can't bind to port
Date Wed, 26 Aug 2015 16:18:02 GMT
Repository: hbase
Updated Branches:
  refs/heads/master dc79b3c5c -> ff86749ca


HBASE-14078 improve error message when HMaster can't bind to port


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

Branch: refs/heads/master
Commit: ff86749caeb63eafcf10cbfba45334757a791384
Parents: dc79b3c
Author: stack <stack@apache.org>
Authored: Wed Aug 26 09:17:33 2015 -0700
Committer: stack <stack@apache.org>
Committed: Wed Aug 26 09:17:46 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/master/HMaster.java   | 18 ++++++++----------
 .../hadoop/hbase/regionserver/RSRpcServices.java  | 16 ++++++++++++----
 2 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ff86749c/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index 34776d5..7834f25 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -2306,16 +2306,14 @@ public class HMaster extends HRegionServer implements MasterServices,
Server {
       Constructor<? extends HMaster> c =
         masterClass.getConstructor(Configuration.class, CoordinatedStateManager.class);
       return c.newInstance(conf, cp);
-    } catch (InvocationTargetException ite) {
-      Throwable target = ite.getTargetException() != null?
-        ite.getTargetException(): ite;
-      if (target.getCause() != null) target = target.getCause();
-      throw new RuntimeException("Failed construction of Master: " +
-        masterClass.toString(), target);
-    } catch (Exception e) {
-      throw new RuntimeException("Failed construction of Master: " +
-        masterClass.toString() + ((e.getCause() != null)?
-          e.getCause().getMessage(): ""), e);
+    } catch(Exception e) {
+      Throwable error = e;
+      if (e instanceof InvocationTargetException &&
+          ((InvocationTargetException)e).getTargetException() != null) {
+        error = ((InvocationTargetException)e).getTargetException();
+      }
+      throw new RuntimeException("Failed construction of Master: " + masterClass.toString()
+ ". "
+        , error);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/ff86749c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 65cedee..70ac7a6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.net.BindException;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
@@ -946,10 +947,17 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
     String name = rs.getProcessName() + "/" + initialIsa.toString();
     // Set how many times to retry talking to another server over HConnection.
     ConnectionUtils.setServerSideHConnectionRetriesConfig(rs.conf, name, LOG);
-    rpcServer = new RpcServer(rs, name, getServices(),
-      bindAddress, // use final bindAddress for this server.
-      rs.conf,
-      rpcSchedulerFactory.create(rs.conf, this, rs));
+    try {
+      rpcServer = new RpcServer(rs, name, getServices(),
+        bindAddress, // use final bindAddress for this server.
+        rs.conf,
+        rpcSchedulerFactory.create(rs.conf, this, rs));
+    } catch(BindException be) {
+      String configName = (this instanceof MasterRpcServices) ? HConstants.MASTER_PORT :
+        HConstants.REGIONSERVER_PORT;
+        throw new IOException(be.getMessage() + ". To switch ports use the '" + configName
+
+          "' configuration property.", be.getCause() != null ? be.getCause() : be);
+    }
 
     scannerLeaseTimeoutPeriod = rs.conf.getInt(
       HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,


Mime
View raw message