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 79C6E200C76 for ; Fri, 28 Apr 2017 15:53:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78788160B8C; Fri, 28 Apr 2017 13:53:41 +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 C7E3C160BB8 for ; Fri, 28 Apr 2017 15:53:40 +0200 (CEST) Received: (qmail 15814 invoked by uid 500); 28 Apr 2017 13:53:40 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 15765 invoked by uid 99); 28 Apr 2017 13:53:40 -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; Fri, 28 Apr 2017 13:53:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E2643E1797; Fri, 28 Apr 2017 13:53:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: geomacy@apache.org To: commits@brooklyn.apache.org Date: Fri, 28 Apr 2017 13:53:41 -0000 Message-Id: <4b82b5fb91054472ba93c9f597c409fd@git.apache.org> In-Reply-To: <1af0b6673b2543858644076742943035@git.apache.org> References: <1af0b6673b2543858644076742943035@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/10] brooklyn-server git commit: repeater now respects its timeout more tightly archived-at: Fri, 28 Apr 2017 13:53:41 -0000 repeater now respects its timeout more tightly Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f9cb0b24 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f9cb0b24 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f9cb0b24 Branch: refs/heads/master Commit: f9cb0b2447b02d93fe2b39496320cb1c920be3ff Parents: aae7218 Author: Alex Heneveld Authored: Tue Apr 25 15:06:19 2017 +0100 Committer: Alex Heneveld Committed: Fri Apr 28 14:09:50 2017 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/brooklyn/util/repeat/Repeater.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f9cb0b24/utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java b/utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java index b08050b..a04f58c 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java @@ -90,7 +90,7 @@ public class Repeater implements Callable { private Predicate rethrowImmediatelyCondition = Exceptions.isFatalPredicate(); private boolean warnOnUnRethrownException = true; private boolean shutdown = false; - private ExecutorService executor = MoreExecutors.sameThreadExecutor(); + private ExecutorService executor = MoreExecutors.newDirectExecutorService(); public Repeater() { this(null); @@ -367,6 +367,9 @@ public class Repeater implements Callable { try { while (true) { Duration delayThisIteration = delayOnIteration.apply(iterations); + if (timer.isNotPaused() && delayThisIteration.isLongerThan(timer.getDurationRemaining())) { + delayThisIteration = timer.getDurationRemaining(); + } iterations++; Future call = executor.submit(body);