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 7A490200CFC for ; Thu, 28 Sep 2017 14:52:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78CD81609C2; Thu, 28 Sep 2017 12:52:29 +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 974851609CD for ; Thu, 28 Sep 2017 14:52:28 +0200 (CEST) Received: (qmail 33441 invoked by uid 500); 28 Sep 2017 12:52:27 -0000 Mailing-List: contact dev-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 dev@brooklyn.apache.org Received: (qmail 33408 invoked by uid 99); 28 Sep 2017 12:52:27 -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; Thu, 28 Sep 2017 12:52:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3D95DF5BB7; Thu, 28 Sep 2017 12:52:27 +0000 (UTC) From: aledsage To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-server pull request #816: Tasks code improvements - prep for better... Content-Type: text/plain Message-Id: <20170928125227.3D95DF5BB7@git1-us-west.apache.org> Date: Thu, 28 Sep 2017 12:52:27 +0000 (UTC) archived-at: Thu, 28 Sep 2017 12:52:29 -0000 Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/816#discussion_r140608998 --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/repeat/Repeater.java --- @@ -269,6 +274,21 @@ public Boolean call() throws Exception { }); } + public Repeater until(final Supplier supplier, final Predicate exitCondition) { + Preconditions.checkNotNull(supplier, "supplier must not be null"); + Preconditions.checkNotNull(exitCondition, "exitCondition must not be null"); + return until(new Callable() { + @Override + public Boolean call() throws Exception { + return exitCondition.apply(supplier.get()); + } + @Override + public String toString() { + return supplier.get()+" "+exitCondition.toString(); --- End diff -- Should the toString really call `supplier.get()`? I'd have just used the toString of the supplier itself. ---