Class AutoPartitionLoadBalancingStrategy
- java.lang.Object
-
- com.graphdbapi.driver.internal.cluster.loadbalancing.AutoPartitionLoadBalancingStrategy
-
- All Implemented Interfaces:
LoadBalancingStrategy
public class AutoPartitionLoadBalancingStrategy extends Object implements LoadBalancingStrategy
负载均衡策略,用于查找来自路由表中的相应分片存储的服务器地址。
-
-
Constructor Summary
Constructors Constructor Description AutoPartitionLoadBalancingStrategy(com.graphdbapi.driver.v1.Driver driver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<com.graphdbapi.driver.internal.BoltServerAddress,Set<Long>>
getAddressPartsMap()
com.graphdbapi.driver.internal.BoltServerAddress
select(com.graphdbapi.driver.internal.BoltServerAddress[] knownServers, com.graphdbapi.driver.internal.cluster.StrategyParam params)
在给定的地址数组中选择最合适的地址。void
setGraphIndex(Integer graphIndex)
-
-
-
Constructor Detail
-
AutoPartitionLoadBalancingStrategy
public AutoPartitionLoadBalancingStrategy(com.graphdbapi.driver.v1.Driver driver)
- Parameters:
driver
- 使用cluster://创建的驱动对象实例- Throws:
NoSuchFieldException
- 可能driver中获取分片信息的时候存在空值对象
-
-
Method Detail
-
select
public com.graphdbapi.driver.internal.BoltServerAddress select(com.graphdbapi.driver.internal.BoltServerAddress[] knownServers, com.graphdbapi.driver.internal.cluster.StrategyParam params)
Description copied from interface:LoadBalancingStrategy
在给定的地址数组中选择最合适的地址。- Specified by:
select
in interfaceLoadBalancingStrategy
- Parameters:
knownServers
- 已知路由表中的地址数组params
- 自定义策略所需要的属性,例如执行语句中的方法名、图INDEX、执行的参数- Returns:
- 选择连接的地址
-
getAddressPartsMap
public Map<com.graphdbapi.driver.internal.BoltServerAddress,Set<Long>> getAddressPartsMap()
-
setGraphIndex
public void setGraphIndex(Integer graphIndex)
-
-