@ThreadSafe public class DseLoadBalancingPolicy extends Object implements LoadBalancingPolicy, RequestTracker
To activate this policy, modify the basic.load-balancing-policy
section in the DSE
driver configuration, for example:
datastax-java-driver { basic.load-balancing-policy { class = com.datastax.dse.driver.internal.core.loadbalancing.DseLoadBalancingPolicy local-datacenter = datacenter1 } }See
reference.conf
(in the manual or OSS driver JAR) and dse-reference.conf
(in
the manual or DSE driver JAR) for more details.LoadBalancingPolicy.DistanceReporter
Constructor and Description |
---|
DseLoadBalancingPolicy(DriverContext context,
String profileName) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
init(Map<UUID,Node> nodes,
LoadBalancingPolicy.DistanceReporter distanceReporter) |
Queue<Node> |
newQueryPlan(Request request,
Session session) |
void |
onAdd(Node node) |
void |
onDown(Node node) |
void |
onNodeError(Request request,
Throwable error,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node) |
void |
onNodeSuccess(Request request,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node) |
void |
onRemove(Node node) |
void |
onUp(Node node) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onError, onSuccess
public DseLoadBalancingPolicy(@NonNull DriverContext context, @NonNull String profileName)
public void init(@NonNull Map<UUID,Node> nodes, @NonNull LoadBalancingPolicy.DistanceReporter distanceReporter)
init
in interface LoadBalancingPolicy
@NonNull public Queue<Node> newQueryPlan(@Nullable Request request, @Nullable Session session)
newQueryPlan
in interface LoadBalancingPolicy
public void onAdd(@NonNull Node node)
onAdd
in interface LoadBalancingPolicy
public void onUp(@NonNull Node node)
onUp
in interface LoadBalancingPolicy
public void onDown(@NonNull Node node)
onDown
in interface LoadBalancingPolicy
public void onRemove(@NonNull Node node)
onRemove
in interface LoadBalancingPolicy
public void onNodeSuccess(@NonNull Request request, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node)
onNodeSuccess
in interface RequestTracker
public void onNodeError(@NonNull Request request, @NonNull Throwable error, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node)
onNodeError
in interface RequestTracker
public void close()
close
in interface LoadBalancingPolicy
close
in interface AutoCloseable
Copyright © 2017–2019. All rights reserved.