Module org.neo4j.driver
Class LeastConnectedLoadBalancingStrategy
java.lang.Object
org.neo4j.driver.internal.cluster.loadbalancing.LeastConnectedLoadBalancingStrategy
- All Implemented Interfaces:
LoadBalancingStrategy
Load balancing strategy that finds server with the least amount of active (checked out of the pool) connections from given readers or writers. It finds a
start index for iteration in a round-robin fashion. This is done to prevent choosing same first address over and over when all addresses have the same amount
of active connections.
-
Constructor Summary
ConstructorDescriptionLeastConnectedLoadBalancingStrategy
(ConnectionPool connectionPool, Logging logging) -
Method Summary
Modifier and TypeMethodDescriptionorg.neo4j.driver.internal.BoltServerAddress
selectReader
(List<org.neo4j.driver.internal.BoltServerAddress> knownReaders) Select most appropriate read address from the given array of addresses.org.neo4j.driver.internal.BoltServerAddress
selectWriter
(List<org.neo4j.driver.internal.BoltServerAddress> knownWriters) Select most appropriate write address from the given array of addresses.
-
Constructor Details
-
LeastConnectedLoadBalancingStrategy
-
-
Method Details
-
selectReader
public org.neo4j.driver.internal.BoltServerAddress selectReader(List<org.neo4j.driver.internal.BoltServerAddress> knownReaders) Description copied from interface:LoadBalancingStrategy
Select most appropriate read address from the given array of addresses.- Specified by:
selectReader
in interfaceLoadBalancingStrategy
- Parameters:
knownReaders
- array of all known readers.- Returns:
- most appropriate reader or
null
if it can't be selected.
-
selectWriter
public org.neo4j.driver.internal.BoltServerAddress selectWriter(List<org.neo4j.driver.internal.BoltServerAddress> knownWriters) Description copied from interface:LoadBalancingStrategy
Select most appropriate write address from the given array of addresses.- Specified by:
selectWriter
in interfaceLoadBalancingStrategy
- Parameters:
knownWriters
- array of all known writers.- Returns:
- most appropriate writer or
null
if it can't be selected.
-