You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ji...@apache.org on 2016/12/01 07:48:54 UTC

incubator-eagle git commit: [EAGLE-817] add KillOptions when stop a topology

Repository: incubator-eagle
Updated Branches:
  refs/heads/master df9d9b085 -> c52e23c74


[EAGLE-817] add KillOptions when stop a topology

Author: wujinhu <wu...@126.com>

Closes #702 from wujinhu/EAGLE-817.


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

Branch: refs/heads/master
Commit: c52e23c748ba5f0f497622f8a2d50bcd7de340a9
Parents: df9d9b0
Author: wujinhu <wu...@126.com>
Authored: Thu Dec 1 15:48:49 2016 +0800
Committer: wujinhu <wu...@126.com>
Committed: Thu Dec 1 15:48:49 2016 +0800

----------------------------------------------------------------------
 .../app/environment/impl/StormExecutionRuntime.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/c52e23c7/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
index 4a9b2b7..a4e9fac 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/environment/impl/StormExecutionRuntime.java
@@ -43,6 +43,7 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
     private static LocalCluster _localCluster;
 
     private StormEnvironment environment;
+    private KillOptions killOptions;
 
     private static LocalCluster getLocalCluster() {
         if (_localCluster == null) {
@@ -51,6 +52,11 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
         return _localCluster;
     }
 
+    public StormExecutionRuntime() {
+        this.killOptions = new KillOptions();
+        this.killOptions.set_wait_secs(0);
+    }
+
     @Override
     public void prepare(StormEnvironment environment) {
         this.environment = environment;
@@ -148,15 +154,13 @@ public class StormExecutionRuntime implements ExecutionRuntime<StormEnvironment,
         if (Objects.equals(config.getString("mode"), ApplicationEntity.Mode.CLUSTER.name())) {
             Nimbus.Client stormClient = NimbusClient.getConfiguredClient(getStormConfig(config)).getClient();
             try {
-                stormClient.killTopology(appId);
+                stormClient.killTopologyWithOpts(appId, this.killOptions);
             } catch (NotAliveException | TException e) {
                 LOG.error("Failed to kill topology named {}, due to: {}",appId,e.getMessage(),e.getCause());
                 throw new RuntimeException(e.getMessage(),e);
             }
         } else {
-            KillOptions killOptions = new KillOptions();
-            killOptions.set_wait_secs(0);
-            getLocalCluster().killTopologyWithOpts(appId,killOptions);
+            getLocalCluster().killTopologyWithOpts(appId, this.killOptions);
         }
         LOG.info("Stopped topology {}", appId);
     }