From 275d120e8f2df481c5d5d488b349036a3d15791a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 10 Nov 2016 09:39:34 +0000
Subject: [PATCH] OPENDJ-3425: rename "sharded" load-balancer to "affinity"
---
opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java | 6 +++---
opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java | 12 ++++++------
opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java | 18 +++++++++---------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java
index 5efdda3..bfd9999 100644
--- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java
+++ b/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java
@@ -426,7 +426,7 @@
* @param options
* This configuration options for the load-balancer.
* @return The new round-robin load balancer.
- * @see #newShardedRequestLoadBalancer(Collection, Options)
+ * @see #newAffinityRequestLoadBalancer(Collection, Options)
* @see #newFailoverLoadBalancer(Collection, Options)
* @see #newLeastRequestsLoadBalancer(Collection, Options)
* @see #LOAD_BALANCER_EVENT_LISTENER
@@ -495,7 +495,7 @@
* This configuration options for the load-balancer.
* @return The new fail-over load balancer.
* @see #newRoundRobinLoadBalancer(Collection, Options)
- * @see #newShardedRequestLoadBalancer(Collection, Options)
+ * @see #newAffinityRequestLoadBalancer(Collection, Options)
* @see #newLeastRequestsLoadBalancer(Collection, Options)
* @see #LOAD_BALANCER_EVENT_LISTENER
* @see #LOAD_BALANCER_MONITORING_INTERVAL
@@ -513,7 +513,7 @@
}
/**
- * Creates a new "sharded" load-balancer which will load-balance individual requests across the provided set of
+ * Creates a new "affinity" load-balancer which will load-balance individual requests across the provided set of
* connection factories, each typically representing a single replica, using an algorithm that ensures that requests
* targeting a given DN will always be routed to the same replica. In other words, this load-balancer increases
* consistency whilst maintaining read-scalability by simulating a "single master" replication topology, where each
@@ -553,16 +553,16 @@
* @see #LOAD_BALANCER_MONITORING_INTERVAL
* @see #LOAD_BALANCER_SCHEDULER
*/
- public static ConnectionFactory newShardedRequestLoadBalancer(
+ public static ConnectionFactory newAffinityRequestLoadBalancer(
final Collection<? extends ConnectionFactory> factories, final Options options) {
- return new RequestLoadBalancer("ShardedRequestLoadBalancer",
+ return new RequestLoadBalancer("AffinityRequestLoadBalancer",
factories,
options,
- newShardedRequestLoadBalancerNextFunction(factories),
+ newAffinityRequestLoadBalancerNextFunction(factories),
NOOP_END_OF_REQUEST_FUNCTION);
}
- static Function<Request, RequestWithIndex, NeverThrowsException> newShardedRequestLoadBalancerNextFunction(
+ static Function<Request, RequestWithIndex, NeverThrowsException> newAffinityRequestLoadBalancerNextFunction(
final Collection<? extends ConnectionFactory> factories) {
return new Function<Request, RequestWithIndex, NeverThrowsException>() {
private final int maxIndex = factories.size();
@@ -637,7 +637,7 @@
* In other words, this load-balancer provides availability and partition tolerance, but sacrifices consistency.
* When a replica is not available, its number of active requests will not decrease until the requests time out,
* which will have the effect of directing requests to the other replicas. Consistency is low compared to the
- * "sharded" load-balancer, because there is no guarantee that requests for the same DN are directed to the same
+ * "affinity" load-balancer, because there is no guarantee that requests for the same DN are directed to the same
* replica.
* <p/>
* It is possible to increase consistency by providing a {@link AffinityControl} with a
@@ -664,7 +664,7 @@
* @return The new least requests load balancer.
* @see #newRoundRobinLoadBalancer(Collection, Options)
* @see #newFailoverLoadBalancer(Collection, Options)
- * @see #newShardedRequestLoadBalancer(Collection, Options)
+ * @see #newAffinityRequestLoadBalancer(Collection, Options)
* @see #LOAD_BALANCER_EVENT_LISTENER
* @see #LOAD_BALANCER_MONITORING_INTERVAL
* @see #LOAD_BALANCER_SCHEDULER
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java
index c1bbae9..fdd3d3b 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java
@@ -74,10 +74,10 @@
}
@Test
- public void shardedRequestLoadBalancerUsesConsistentIndexing() {
+ public void affinityRequestLoadBalancerUsesConsistentIndexing() {
final Function<Request, RequestWithIndex, NeverThrowsException> f =
- newShardedRequestLoadBalancerNextFunction(asList(mock(ConnectionFactory.class),
- mock(ConnectionFactory.class)));
+ newAffinityRequestLoadBalancerNextFunction(asList(mock(ConnectionFactory.class),
+ mock(ConnectionFactory.class)));
// These two DNs have a different hash code.
final DN dn1 = DN.valueOf("cn=target1,dc=example,dc=com");
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
index 75f9c42..88f6b88 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
@@ -57,7 +57,7 @@
* <remoteAddress1> <remotePort1> [<remoteAddress2> <remotePort2> ...]}
* </pre>
*
- * Where {@code <mode>} is one of "round-robin", "fail-over", or "sharded". The default is round-robin.
+ * Where {@code <mode>} is one of "round-robin", "fail-over", or "affinity". The default is round-robin.
*/
public final class Proxy {
/**
@@ -164,11 +164,11 @@
return LoadBalancingAlgorithm.ROUND_ROBIN;
case "fail-over":
return LoadBalancingAlgorithm.FAIL_OVER;
- case "sharded":
- return LoadBalancingAlgorithm.SHARDED;
+ case "affinity":
+ return LoadBalancingAlgorithm.AFFINITY;
default:
System.err.println("Unrecognized load-balancing algorithm '" + algorithmName + "'. Should be one of "
- + "'round-robin', 'fail-over', or 'sharded'.");
+ + "'round-robin', 'fail-over', or 'affinity'.");
System.exit(1);
}
return LoadBalancingAlgorithm.ROUND_ROBIN; // keep compiler happy.
@@ -189,10 +189,10 @@
return Connections.newFailoverLoadBalancer(factories, options);
}
},
- SHARDED {
+ AFFINITY {
@Override
ConnectionFactory newLoadBalancer(final Collection<ConnectionFactory> factories, final Options options) {
- return Connections.newShardedRequestLoadBalancer(factories, options);
+ return Connections.newAffinityRequestLoadBalancer(factories, options);
}
};
--
Gitblit v1.10.0