public interface ClusterNodeSelector
ClusterNodeSelector
involve load balancing of calls to various nodes in the cluster.Modifier and Type | Field and Description |
---|---|
static ClusterNodeSelector |
DEFAULT
A simple default selector which uses
simpleConnectionThresholdRandomSelector(int) with a minimum of
5 connections. |
static ClusterNodeSelector |
DEFAULT_PREFER_LOCAL
A deployment node selector which check the server name if inside and prefer it if available for selection.
|
static ClusterNodeSelector |
FIRST_AVAILABLE
Always use the first available node, regardless of whether it is connected.
|
static ClusterNodeSelector |
FIRST_CONNECTED
Always use the first connected node, or fall back to the first available node if none are connected.
|
static ClusterNodeSelector |
RANDOM
Use a random available node, regardless of whether it is connected.
|
static ClusterNodeSelector |
RANDOM_CONNECTED
Always use a random connected node, or fall back to a random unconnected node.
|
static ClusterNodeSelector |
RANDOM_PREFER_LOCAL |
static ClusterNodeSelector |
ROUND_ROBIN
Use available nodes in a round-robin fashion, regardless of whether it is connected.
|
Modifier and Type | Method and Description |
---|---|
static ClusterNodeSelector |
firstConnected(ClusterNodeSelector fallback)
Always try to use the first connected node.
|
static ClusterNodeSelector |
minimumConnectionThreshold(int minimum,
ClusterNodeSelector unmet,
ClusterNodeSelector met)
Determine the action to take based on a threshold of minimum connections.
|
String |
selectNode(String clusterName,
String[] connectedNodes,
String[] totalAvailableNodes)
Returns a node from among the
totalAvailableNodes , as the target node for EJB invocations. |
static ClusterNodeSelector |
simpleConnectionThresholdRandomSelector(int minimum)
A simple threshold-based random selector.
|
static ClusterNodeSelector |
useRandomConnectedNode(ClusterNodeSelector fallback)
Always try to use a random connected node.
|
static ClusterNodeSelector |
useRandomUnconnectedNode(ClusterNodeSelector fallback)
Always try to use an unconnected node.
|
static ClusterNodeSelector |
useRoundRobinConnectedNode(ClusterNodeSelector fallback)
Always try to round-robin among connected nodes.
|
static ClusterNodeSelector |
useRoundRobinUnconnectedNode(ClusterNodeSelector fallback)
Always try to use an unconnected node in a round-robin fashion.
|
static final ClusterNodeSelector FIRST_AVAILABLE
static final ClusterNodeSelector FIRST_CONNECTED
static final ClusterNodeSelector RANDOM_CONNECTED
static final ClusterNodeSelector RANDOM
static final ClusterNodeSelector ROUND_ROBIN
static final ClusterNodeSelector DEFAULT
simpleConnectionThresholdRandomSelector(int)
with a minimum of
5 connections.static final ClusterNodeSelector DEFAULT_PREFER_LOCAL
static final ClusterNodeSelector RANDOM_PREFER_LOCAL
String selectNode(String clusterName, String[] connectedNodes, String[] totalAvailableNodes)
totalAvailableNodes
, as the target node for EJB invocations.
The selector can decide whether to pick an already connected node (from the passed connectedNodes
)
or decide to select a node to which a connection hasn't yet been established. If a node to which a connection
hasn't been established is selected then the cluster context will create a connection to it.clusterName
- the name of the cluster to which the nodes belong (will not be null
)connectedNodes
- the node names to which a connection has been established (may be empty but will not be null
)totalAvailableNodes
- all available nodes in the cluster, including connected nodes (will not be empty or null
)null
)static ClusterNodeSelector simpleConnectionThresholdRandomSelector(int minimum)
minimum
- the minimum number of connected nodes to attempt to acquirenull
)static ClusterNodeSelector firstConnected(ClusterNodeSelector fallback)
fallback
- the fallback selector (must not be null
)null
)static ClusterNodeSelector useRandomConnectedNode(ClusterNodeSelector fallback)
fallback
- the fallback selector (must not be null
)null
)static ClusterNodeSelector useRoundRobinConnectedNode(ClusterNodeSelector fallback)
fallback
- the fallback selector (must not be null
)null
)static ClusterNodeSelector minimumConnectionThreshold(int minimum, ClusterNodeSelector unmet, ClusterNodeSelector met)
met
selector is used, otherwise the unmet
selector is used.minimum
- the minimum number of connectionsunmet
- the selector to use when the number of connections is below the minimum and there are unconnected nodes (must not be null
)met
- the selector to use when the number of connections is at or above the minimum or there are no unconnected nodes (must not be null
)null
)static ClusterNodeSelector useRandomUnconnectedNode(ClusterNodeSelector fallback)
fallback
- the selector to use if all available nodes are connected (must not be null
)null
)static ClusterNodeSelector useRoundRobinUnconnectedNode(ClusterNodeSelector fallback)
fallback
- the selector to use if all available nodes are connected (must not be null
)null
)Copyright © 2021 JBoss by Red Hat. All rights reserved.