Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 926DB200BC9 for ; Wed, 19 Oct 2016 05:27:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 911C0160AFE; Wed, 19 Oct 2016 03:27:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DE2F5160AFD for ; Wed, 19 Oct 2016 05:27:24 +0200 (CEST) Received: (qmail 34266 invoked by uid 500); 19 Oct 2016 03:27:24 -0000 Mailing-List: contact commits-help@eagle.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.incubator.apache.org Delivered-To: mailing list commits@eagle.incubator.apache.org Received: (qmail 34255 invoked by uid 99); 19 Oct 2016 03:27:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 03:27:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 96D38C0C04 for ; Wed, 19 Oct 2016 03:27:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id UsYVLPiJwqf1 for ; Wed, 19 Oct 2016 03:27:21 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 0F9ED5FC45 for ; Wed, 19 Oct 2016 03:27:18 +0000 (UTC) Received: (qmail 33085 invoked by uid 99); 19 Oct 2016 03:27:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 03:27:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 70E07E2EF2; Wed, 19 Oct 2016 03:27:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hao@apache.org To: commits@eagle.incubator.apache.org Date: Wed, 19 Oct 2016 03:27:44 -0000 Message-Id: <072bfcb3ed694c51b7cf06668cadcd34@git.apache.org> In-Reply-To: <679f7884b2ff4acc87cbf4e51a1de5db@git.apache.org> References: <679f7884b2ff4acc87cbf4e51a1de5db@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [29/50] incubator-eagle git commit: [EAGLE-616] AlertEngine: Reduce the connection from alert-service to ZK archived-at: Wed, 19 Oct 2016 03:27:25 -0000 [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 Authored: Thu Oct 13 17:28:06 2016 +0800 Committer: Ralph, Su 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));