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