You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by km...@apache.org on 2015/05/21 17:34:11 UTC

knox git commit: KNOX-544: Knox process does not exit if startup fails due to credential store issues

Repository: knox
Updated Branches:
  refs/heads/master c6af41252 -> 43b8b43ba


KNOX-544: Knox process does not exit if startup fails due to credential store issues


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

Branch: refs/heads/master
Commit: 43b8b43ba4ba1a9489b09338dfbe2fdfa972dcea
Parents: c6af412
Author: Kevin Minder <ke...@hortonworks.com>
Authored: Thu May 21 11:34:04 2015 -0400
Committer: Kevin Minder <ke...@hortonworks.com>
Committed: Thu May 21 11:34:04 2015 -0400

----------------------------------------------------------------------
 .../apache/hadoop/gateway/GatewayServer.java    | 41 +++++++++-----------
 .../hadoop/gateway/GatewayAdminFuncTest.java    |  2 +-
 .../gateway/GatewayAdminTopologyFuncTest.java   |  2 +-
 .../hadoop/gateway/GatewayDeployFuncTest.java   |  2 +-
 .../hadoop/gateway/GatewayFuncTestDriver.java   |  2 +-
 .../gateway/GatewayLocalServiceFuncTest.java    |  2 +-
 .../hadoop/gateway/GatewaySampleFuncTest.java   |  2 +-
 7 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
index cf4b662..9dbd238 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
@@ -117,8 +117,10 @@ public class GatewayServer {
     } catch ( ParseException e ) {
       log.failedToParseCommandLine( e );
       GatewayCommandLine.printHelp();
-    } catch ( ServiceLifecycleException e ) {
+    } catch ( Exception e ) {
       log.failedToStartGateway( e );
+      // Make sure the process exits.
+      System.exit(1);
     }
   }
 
@@ -225,27 +227,22 @@ public class GatewayServer {
     ts.redeployTopologies(topologyName);
   }
 
-  public static GatewayServer startGateway( GatewayConfig config, GatewayServices svcs ) {
-    try {
-      log.startingGateway();
-      server = new GatewayServer( config );
-      synchronized ( server ) {
-        //KM[ Commented this out because is causes problems with
-        // multiple services instance used in a single test process.
-        // I'm not sure what drive including this check though.
-        //if (services == null) {
-        services = svcs;
-        //}
-        //KM]
-        services.start();
-        DeploymentFactory.setGatewayServices(services);
-        server.start();
-        log.startedGateway( server.jetty.getConnectors()[ 0 ].getLocalPort() );
-        return server;
-      }
-    } catch( Exception e ) {
-      log.failedToStartGateway( e );
-      return null;
+  public static GatewayServer startGateway( GatewayConfig config, GatewayServices svcs ) throws Exception {
+    log.startingGateway();
+    server = new GatewayServer( config );
+    synchronized ( server ) {
+      //KM[ Commented this out because is causes problems with
+      // multiple services instance used in a single test process.
+      // I'm not sure what drive including this check though.
+      //if (services == null) {
+      services = svcs;
+      //}
+      //KM]
+      services.start();
+      DeploymentFactory.setGatewayServices(services);
+      server.start();
+      log.startedGateway( server.jetty.getConnectors()[ 0 ].getLocalPort() );
+      return server;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminFuncTest.java
index efd02a2..cbf560c 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminFuncTest.java
@@ -86,7 +86,7 @@ public class GatewayAdminFuncTest {
     LOG.info( "LDAP port = " + ldapTransport.getPort() );
   }
 
-  public static void setupGateway() throws IOException {
+  public static void setupGateway() throws Exception {
 
     File targetDir = new File( System.getProperty( "user.dir" ), "target" );
     File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
index ff32a74..0488a44 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayAdminTopologyFuncTest.java
@@ -101,7 +101,7 @@ public class GatewayAdminTopologyFuncTest {
     LOG.info( "LDAP port = " + ldapTransport.getPort() );
   }
 
-  public static void setupGateway() throws IOException {
+  public static void setupGateway() throws Exception {
 
     File targetDir = new File( System.getProperty( "user.dir" ), "target" );
     File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayDeployFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayDeployFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayDeployFuncTest.java
index 3535f43..fc2fd70 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayDeployFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayDeployFuncTest.java
@@ -95,7 +95,7 @@ public class GatewayDeployFuncTest {
   }
 
   @Before
-  public void setupGateway() throws IOException {
+  public void setupGateway() throws Exception {
 
     File targetDir = new File( System.getProperty( "user.dir" ), "target" );
     File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayFuncTestDriver.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayFuncTestDriver.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayFuncTestDriver.java
index af707b1..2d6c4be 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayFuncTestDriver.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayFuncTestDriver.java
@@ -127,7 +127,7 @@ public class GatewayFuncTestDriver {
   /**
    * Creates a GATEWAY_HOME, starts a gateway instance and deploys a test topology.
    */
-  public void setupGateway( GatewayTestConfig config, String cluster, XMLTag topology, boolean use ) throws IOException {
+  public void setupGateway( GatewayTestConfig config, String cluster, XMLTag topology, boolean use ) throws Exception {
     this.useGateway = use;
     this.config = config;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayLocalServiceFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayLocalServiceFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayLocalServiceFuncTest.java
index 5a40d77..1cabeda 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayLocalServiceFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewayLocalServiceFuncTest.java
@@ -90,7 +90,7 @@ public class GatewayLocalServiceFuncTest {
     LOG.info( "LDAP port = " + ldapTransport.getPort() );
   }
 
-  public static void setupGateway() throws IOException {
+  public static void setupGateway() throws Exception {
 
     File targetDir = new File( System.getProperty( "user.dir" ), "target" );
     File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );

http://git-wip-us.apache.org/repos/asf/knox/blob/43b8b43b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
index 21c088c..a12ce20 100644
--- a/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/hadoop/gateway/GatewaySampleFuncTest.java
@@ -88,7 +88,7 @@ public class GatewaySampleFuncTest {
     LOG.info( "LDAP port = " + ldapTransport.getPort() );
   }
 
-  public static void setupGateway() throws IOException {
+  public static void setupGateway() throws Exception {
 
     File targetDir = new File( System.getProperty( "user.dir" ), "target" );
     File gatewayDir = new File( targetDir, "gateway-home-" + UUID.randomUUID() );