eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject [29/50] incubator-eagle git commit: [EAGLE-616] AlertEngine: Reduce the connection from alert-service to ZK
Date Wed, 19 Oct 2016 03:27:44 GMT
[EAGLE-616] AlertEngine: Reduce the connection from alert-service to ZK

Author: Zeng, Bryant
Reviewer: ralphsu

This closes #501


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

Branch: refs/heads/master
Commit: 98d1964ff6bd19c706952fd4b09ad40dbc5a4870
Parents: 2e715e3
Author: mizeng <mizeng@ebaysf.com>
Authored: Thu Oct 13 17:28:06 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Fri Oct 14 17:38:16 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/eagle/alert/coordinator/Coordinator.java   | 1 +
 .../eagle/alert/coordinator/trigger/CoordinatorTrigger.java    | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/98d1964f/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
index dc3e3d6..e0bd5c3 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/Coordinator.java
@@ -185,6 +185,7 @@ public class Coordinator {
         for (String topo : state.getPublishSpecs().keySet()) {
             producer.send(MessageFormat.format(ZK_ALERT_CONFIG_PUBLISHER, topo), value);
         }
+
     }
 
     public ScheduleState getState() {

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/98d1964f/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
index ce3c02b..e0e0612 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-coordinator/src/main/java/org/apache/eagle/alert/coordinator/trigger/CoordinatorTrigger.java
@@ -65,8 +65,10 @@ public class CoordinatorTrigger implements Runnable {
 
                 ScheduleState state = scheduler.schedule(new ScheduleOption());
 
-                ConfigBusProducer producer = new ConfigBusProducer(ZKConfigBuilder.getZKConfig(config));
-                Coordinator.postSchedule(client, state, producer);
+                // use try catch to use AutoCloseable interface to close producer automatically
+                try (ConfigBusProducer producer = new ConfigBusProducer(ZKConfigBuilder.getZKConfig(config)))
{
+                    Coordinator.postSchedule(client, state, producer);
+                }
 
                 watch.stop();
                 LOG.info("CoordinatorTrigger ended, used time {} sm.", watch.elapsed(TimeUnit.MILLISECONDS));


Mime
View raw message