Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C365D11E47 for ; Tue, 9 Sep 2014 10:17:49 +0000 (UTC) Received: (qmail 57259 invoked by uid 500); 9 Sep 2014 10:17:49 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 57238 invoked by uid 500); 9 Sep 2014 10:17:49 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 57229 invoked by uid 99); 9 Sep 2014 10:17:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 10:17:49 +0000 X-ASF-Spam-Status: No, hits=-2001.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 09 Sep 2014 10:17:27 +0000 Received: (qmail 56880 invoked by uid 99); 9 Sep 2014 10:17:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 10:17:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C7C1EA0FDC2; Tue, 9 Sep 2014 10:17:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.incubator.apache.org Date: Tue, 09 Sep 2014 10:17:24 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: Add javadoc to QuorumCheck X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-brooklyn Updated Branches: refs/heads/master 9283ab0c2 -> 8e505a50e Add javadoc to QuorumCheck Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/eec69f3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/eec69f3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/eec69f3e Branch: refs/heads/master Commit: eec69f3e44084bb5348ab5950b63a344e58bf895 Parents: 954b397 Author: Aled Sage Authored: Fri Sep 5 16:09:01 2014 +0100 Committer: Aled Sage Committed: Fri Sep 5 16:09:01 2014 +0100 ---------------------------------------------------------------------- .../java/brooklyn/entity/basic/QuorumCheck.java | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/eec69f3e/core/src/main/java/brooklyn/entity/basic/QuorumCheck.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/entity/basic/QuorumCheck.java b/core/src/main/java/brooklyn/entity/basic/QuorumCheck.java index 5235413..1c07e95 100644 --- a/core/src/main/java/brooklyn/entity/basic/QuorumCheck.java +++ b/core/src/main/java/brooklyn/entity/basic/QuorumCheck.java @@ -20,25 +20,49 @@ package brooklyn.entity.basic; import java.io.Serializable; +/** + * For checking if a group/cluster is quorate. That is, whether the group has sufficient + * healthy members. + */ public interface QuorumCheck { + /** + * @param sizeHealthy Number of healthy members + * @param totalSize Total number of members one would expect to be healthy (i.e. ignoring stopped members) + * @return Whether this group is healthy + */ public boolean isQuorate(int sizeHealthy, int totalSize); public static class QuorumChecks { + /** + * Checks that all members that should be up are up (i.e. ignores stopped nodes). + */ public static QuorumCheck all() { return new NumericQuorumCheck(0, 1.0, false); } + /** + * Checks all members that should be up are up, and that there is at least one such member. + */ public static QuorumCheck allAndAtLeastOne() { return new NumericQuorumCheck(1, 1.0, false); } + /** + * Requires at least one member that should be up is up. + */ public static QuorumCheck atLeastOne() { return new NumericQuorumCheck(1, 0.0, false); } - /** require at least one to be up if the total size is non-zero; - * ie okay if empty, or if non-empty and something is healthy, but not okay if not-empty and nothing is healthy */ + /** + * Requires at least one member to be up if the total size is non-zero. + * i.e. okay if empty, or if non-empty and something is healthy, but not okay if not-empty and nothing is healthy. + * "Empty" means that no members are supposed to be up (e.g. there may be stopped members). + */ public static QuorumCheck atLeastOneUnlessEmpty() { return new NumericQuorumCheck(1, 0.0, true); } + /** + * Always "healthy" + */ public static QuorumCheck alwaysTrue() { return new NumericQuorumCheck(0, 0.0, true); }