storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [1/4] storm git commit: STORM-2910: Override local nimbus client by default
Date Thu, 01 Feb 2018 20:53:36 GMT
Repository: storm
Updated Branches:
  refs/heads/master d68416b24 -> abf0f8a22


STORM-2910:  Override local nimbus client by default


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

Branch: refs/heads/master
Commit: ed0548e8b61a8ea67007d906953406a264b15c99
Parents: fc4ac8e
Author: Robert (Bobby) Evans <evans@yahoo-inc.com>
Authored: Wed Jan 24 14:47:01 2018 -0600
Committer: Robert (Bobby) Evans <evans@yahoo-inc.com>
Committed: Wed Jan 24 14:48:12 2018 -0600

----------------------------------------------------------------------
 .../src/main/java/org/apache/storm/LocalCluster.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/ed0548e8/storm-server/src/main/java/org/apache/storm/LocalCluster.java
----------------------------------------------------------------------
diff --git a/storm-server/src/main/java/org/apache/storm/LocalCluster.java b/storm-server/src/main/java/org/apache/storm/LocalCluster.java
index 502f454..20a46a3 100644
--- a/storm-server/src/main/java/org/apache/storm/LocalCluster.java
+++ b/storm-server/src/main/java/org/apache/storm/LocalCluster.java
@@ -368,6 +368,7 @@ public class LocalCluster implements ILocalClusterTrackedTopologyAware,
Iface {
     private final String trackId;
     private final StormCommonInstaller commonInstaller;
     private final SimulatedTime time;
+    private final NimbusClient.LocalOverride nimbusOverride;
     
     /**
      * Create a default LocalCluster.
@@ -476,6 +477,13 @@ public class LocalCluster implements ILocalClusterTrackedTopologyAware,
Iface {
             } catch (Exception e) {
                 //Ignore any exceptions we might be doing a test for authentication 
             }
+            if (thriftServer == null) {
+                //We don't want to override the client if there is a thrift server up and
running, or we would not test any
+                // Of the actual thrift code
+                this.nimbusOverride = new NimbusClient.LocalOverride(this);
+            } else {
+                this.nimbusOverride = null;
+            }
             success = true;
         } finally {
             if (!success) {
@@ -658,6 +666,9 @@ public class LocalCluster implements ILocalClusterTrackedTopologyAware,
Iface {
 
     @Override
     public synchronized void close() throws Exception {
+        if (nimbusOverride != null) {
+            nimbusOverride.close();
+        }
         if (nimbus != null) {
             nimbus.shutdown();
         }
@@ -1098,6 +1109,7 @@ public class LocalCluster implements ILocalClusterTrackedTopologyAware,
Iface {
     
     /**
      * Run c with a local mode cluster overriding the NimbusClient and DRPCClient calls.
+     * NOTE local mode override happens by default now unless netty is turned on for the
local cluster.
      * @param c the callable to run in this mode
      * @param ttlSec the number of seconds to let the cluster run after c has completed
      * @return the result of calling C
@@ -1106,7 +1118,6 @@ public class LocalCluster implements ILocalClusterTrackedTopologyAware,
Iface {
     public static <T> T withLocalModeOverride(Callable<T> c, long ttlSec) throws
Exception {
         LOG.info("\n\n\t\tSTARTING LOCAL MODE CLUSTER\n\n");
         try (LocalCluster local = new LocalCluster();
-                NimbusClient.LocalOverride nimbusOverride = new NimbusClient.LocalOverride(local);
                 LocalDRPC drpc = new LocalDRPC();
                 DRPCClient.LocalOverride drpcOverride = new DRPCClient.LocalOverride(drpc))
{
 


Mime
View raw message