public class ConsulClientUtil extends Object
| 构造器和说明 |
|---|
ConsulClientUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
chooseClient(com.google.common.hash.HashCode keyHash,
List<T> clients)
根据一致性算法获取由给定key决定的命中节点
|
static <T> T |
chooseClient(String key,
List<T> clients)
通过一致性算法选择一个由给定key决定的命中节点
|
static com.ecwid.consul.v1.ConsulClient |
createConsulClient(org.springframework.cloud.consul.ConsulProperties consulProperties)
创建 ConsulClient, copy from ConsulAutoConfiguration
|
public static <T> T chooseClient(String key, List<T> clients)
key - - 客户端提供的散列key,例如取自客户机的IPclients - - 在每次调用之前请确保clients的顺序是一致的public static <T> T chooseClient(com.google.common.hash.HashCode keyHash,
List<T> clients)
keyHash - - 散列keyclients - - 在每次调用之前请确保clients的顺序是一致的public static com.ecwid.consul.v1.ConsulClient createConsulClient(org.springframework.cloud.consul.ConsulProperties consulProperties)
Copyright © 2020. All rights reserved.