Skip to content

Commit

Permalink
Rename AuroraClusterMonitor.setReplicaWeight to setHostWeight
Browse files Browse the repository at this point in the history
Since you may want to set the master host weight too, this seems a better name.
  • Loading branch information
jentfoo committed May 14, 2020
1 parent 36960d2 commit 37cefd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static void setExceptionHandler(BiConsumer<AuroraServer, Throwable> handl
}

/**
* Invoke to set the weight for a given replica. This only impacts when a random replica is
* Invoke to set the weight for a given server. This only impacts when a random replica is
* requested, and wont impact the master server usage. The weight must be between {@code 0} and
* {@code 100} inclusive. Ever server starts with a default weight of {@code 1}. A weight of
* {@code 0} indicates to not use the replica unless no other healthy replicas are available.
Expand All @@ -106,7 +106,7 @@ public static void setExceptionHandler(BiConsumer<AuroraServer, Throwable> handl
* @param port The port for the replica server
* @param weight The weight to apply to this replica
*/
public static void setReplicaWeight(String host, int port, int weight) {
public static void setHostWeight(String host, int port, int weight) {
if (weight < 0) {
throw new IllegalArgumentException("Negative server weights not allowed");
} else if (weight > 100) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public void setServerCheckDelayMillisFail() {

@Test (expected = IllegalArgumentException.class)
public void setReplicaWeightNegativeFail() {
AuroraClusterMonitor.setReplicaWeight("host", 3360, -1);
AuroraClusterMonitor.setHostWeight("host", 3360, -1);
fail("Exception expected");
}

@Test (expected = IllegalArgumentException.class)
public void setReplicaWeightMaxFail() {
AuroraClusterMonitor.setReplicaWeight("host", 3360, 101);
AuroraClusterMonitor.setHostWeight("host", 3360, 101);
fail("Exception expected");
}
}

0 comments on commit 37cefd3

Please sign in to comment.