Class AutoPartitionLoadBalancingStrategy

  • All Implemented Interfaces:
    LoadBalancingStrategy

    public class AutoPartitionLoadBalancingStrategy
    extends Object
    implements LoadBalancingStrategy
    负载均衡策略,用于查找来自路由表中的相应分片存储的服务器地址。
    • Constructor Detail

      • AutoPartitionLoadBalancingStrategy

        public AutoPartitionLoadBalancingStrategy​(com.graphdbapi.driver.v1.Driver driver)
                                           throws NoSuchFieldException
        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 interface LoadBalancingStrategy
        Parameters:
        knownServers - 已知路由表中的地址数组
        params - 自定义策略所需要的属性,例如执行语句中的方法名、图INDEX、执行的参数
        Returns:
        选择连接的地址