public class RoundRobinHostSelector extends java.lang.Object implements HostSelector
| Modifier and Type | Class and Description |
|---|---|
static class |
RoundRobinHostSelector.RoundRobinClusterInfo |
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.concurrent.locks.ReentrantLock |
lock |
static AwsWrapperProperty |
ROUND_ROBIN_DEFAULT_WEIGHT |
static AwsWrapperProperty |
ROUND_ROBIN_HOST_WEIGHT_PAIRS |
protected static CacheMap<java.lang.String,RoundRobinHostSelector.RoundRobinClusterInfo> |
roundRobinCache |
static java.lang.String |
STRATEGY_ROUND_ROBIN |
| Constructor and Description |
|---|
RoundRobinHostSelector() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearCache() |
HostSpec |
getHost(@NonNull java.util.List<HostSpec> hosts,
@NonNull HostRole role,
@Nullable java.util.Properties props)
Selects a host with the requested role from the given host list.
|
static void |
setRoundRobinHostWeightPairsProperty(@NonNull java.util.Properties properties,
@NonNull java.util.List<HostSpec> hosts) |
public static final AwsWrapperProperty ROUND_ROBIN_HOST_WEIGHT_PAIRS
public static final AwsWrapperProperty ROUND_ROBIN_DEFAULT_WEIGHT
public static final java.lang.String STRATEGY_ROUND_ROBIN
protected static final CacheMap<java.lang.String,RoundRobinHostSelector.RoundRobinClusterInfo> roundRobinCache
protected static final java.util.concurrent.locks.ReentrantLock lock
public static void setRoundRobinHostWeightPairsProperty(@NonNull java.util.Properties properties,
@NonNull java.util.List<HostSpec> hosts)
public HostSpec getHost(@NonNull java.util.List<HostSpec> hosts, @NonNull HostRole role, @Nullable java.util.Properties props) throws java.sql.SQLException
HostSelectorgetHost in interface HostSelectorhosts - a list of available hosts to pick from.role - the desired host role - either a writer or a reader.props - connection properties that may be needed by the host selector in order to choose a host.java.sql.SQLException - if the host list does not contain any hosts matching the requested role or
an error occurs while selecting a hostpublic static void clearCache()