public enum HaMode extends Enum<HaMode>
| Enum Constant and Description |
|---|
LOADBALANCE
load-balance: driver will connect to any host using round-robin, permitting balancing
connections
|
NONE
no ha-mode.
|
SEQUENTIAL |
| Modifier and Type | Method and Description |
|---|---|
static HaMode |
from(String value)
Get HAMode from values or aliases
|
abstract Optional<HostAddress> |
getAvailableHost(List<HostAddress> hostAddresses,
ConcurrentMap<HostAddress,Long> denyList)
List of hosts without blacklist entries, ordered according to HA mode
|
static Optional<HostAddress> |
getAvailableHostInOrder(List<HostAddress> hostAddresses,
ConcurrentMap<HostAddress,Long> denyList)
Get first available host not in blacklist.
|
static Optional<HostAddress> |
getAvailableRoundRobinHost(HaMode haMode,
List<HostAddress> hostAddresses,
ConcurrentMap<HostAddress,Long> denyList)
Get first available host in RoundRobin Order and not in blacklist.
|
static HostAddress |
getHostWithLessConnections(List<HostAddress> hostAddresses,
ConcurrentMap<HostAddress,Long> denyList)
If all hosts not blacklisted connection number are known, choose the host with the less
connections.
|
void |
resetLast()
For testing purpose only
|
static HaMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static HaMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final HaMode SEQUENTIAL
public static final HaMode LOADBALANCE
public static final HaMode NONE
public static HaMode[] values()
for (HaMode c : HaMode.values()) System.out.println(c);
public static HaMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static HaMode from(String value)
value - value or aliaspublic static Optional<HostAddress> getAvailableHostInOrder(List<HostAddress> hostAddresses, ConcurrentMap<HostAddress,Long> denyList)
hostAddresses - hostsdenyList - blacklistpublic static HostAddress getHostWithLessConnections(List<HostAddress> hostAddresses, ConcurrentMap<HostAddress,Long> denyList)
hostAddresses - host addressesdenyList - blacklistpublic static Optional<HostAddress> getAvailableRoundRobinHost(HaMode haMode, List<HostAddress> hostAddresses, ConcurrentMap<HostAddress,Long> denyList)
haMode - current haModehostAddresses - hostsdenyList - blacklistpublic void resetLast()
public abstract Optional<HostAddress> getAvailableHost(List<HostAddress> hostAddresses, ConcurrentMap<HostAddress,Long> denyList)
hostAddresses - hostsdenyList - hosts temporary deniedCopyright © 2025 SingleStore. All rights reserved.