hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/3] hbase git commit: HBASE-14078 improve error message when HMaster can't bind to port
Date Mon, 07 Sep 2015 04:51:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 30752d581 -> bbafb47f7


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/1f56b55e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1f56b55e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1f56b55e

Branch: refs/heads/branch-1
Commit: 1f56b55e506889598b1a2b3a1affe1de4ead1a1d
Parents: 30752d5
Author: stack <stack@apache.org>
Authored: Wed Aug 26 09:17:33 2015 -0700
Committer: stack <stack@apache.org>
Committed: Fri Sep 4 22:59:21 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/1f56b55e/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 53a535c..2f7b6bc 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
@@ -2309,16 +2309,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/1f56b55e/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 69d2a89..0b939d5 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;
@@ -864,10 +865,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