From pr-return-1161-apmail-cassandra-pr-archive=cassandra.apache.org@cassandra.apache.org Wed Sep 12 06:46:39 2018 Return-Path: X-Original-To: apmail-cassandra-pr-archive@minotaur.apache.org Delivered-To: apmail-cassandra-pr-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 054F51E9DB for ; Wed, 12 Sep 2018 06:46:39 +0000 (UTC) Received: (qmail 99766 invoked by uid 500); 12 Sep 2018 06:46:39 -0000 Delivered-To: apmail-cassandra-pr-archive@cassandra.apache.org Received: (qmail 99742 invoked by uid 500); 12 Sep 2018 06:46:38 -0000 Mailing-List: contact pr-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pr@cassandra.apache.org Delivered-To: mailing list pr@cassandra.apache.org Received: (qmail 99728 invoked by uid 99); 12 Sep 2018 06:46:38 -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, 12 Sep 2018 06:46:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EF78FDFCB9; Wed, 12 Sep 2018 06:46:37 +0000 (UTC) From: belliottsmith To: pr@cassandra.apache.org Reply-To: pr@cassandra.apache.org References: In-Reply-To: Subject: [GitHub] cassandra pull request #265: 14705 Content-Type: text/plain Message-Id: <20180912064637.EF78FDFCB9@git1-us-west.apache.org> Date: Wed, 12 Sep 2018 06:46:37 +0000 (UTC) Github user belliottsmith commented on a diff in the pull request: https://github.com/apache/cassandra/pull/265#discussion_r216913492 --- Diff: src/java/org/apache/cassandra/locator/ReplicaPlan.java --- @@ -249,12 +229,32 @@ public int requiredParticipants() * we progressively modify via various forms of speculation (initial speculation, rr-read and rr-write) * @param

*/ - public static class Shared

> + public interface Shared, P extends ReplicaPlan> { - private P replicaPlan; - public Shared(P replicaPlan) { this.replicaPlan = replicaPlan; } - public void set(P newReplicaPlan) { this.replicaPlan = newReplicaPlan; } - public P get() { return replicaPlan; } + public void addToContact(Replica replica); + public P get(); + public abstract P getWithContact(E endpoints); } + public static class SharedForTokenRead implements Shared + { + private ForTokenRead replicaPlan; + public SharedForTokenRead(ForTokenRead replicaPlan) { this.replicaPlan = replicaPlan; } + public void addToContact(Replica replica) { replicaPlan = replicaPlan.withContact(Endpoints.append(replicaPlan.contact(), replica)); } + public ForTokenRead get() { return replicaPlan; } + public ForTokenRead getWithContact(EndpointsForToken newContact) { return replicaPlan.withContact(newContact); } + } + + public static class SharedForRangeRead implements Shared + { + private ForRangeRead replicaPlan; + public SharedForRangeRead(ForRangeRead replicaPlan) { this.replicaPlan = replicaPlan; } + public void addToContact(Replica replica) { replicaPlan = replicaPlan.withContact(Endpoints.append(replicaPlan.contact(), replica)); } --- End diff -- It does; in general the non-pluralised form of contact doesn't work well with the method names. Perhaps I should just pluralise and be done with it? Not sure why I was averse to this. --- --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org For additional commands, e-mail: pr-help@cassandra.apache.org