Package org.jboss.ejb.client
Interface DeploymentNodeSelector
-
public interface DeploymentNodeSelectorA selector which selects and returns a node, from among the passed eligible nodes, that can handle a specific deployment within an Enterprise Bean client context. Typical usage ofDeploymentNodeSelectorinvolves load balancing calls to multiple nodes which can all handle the same deployment. This allows the application to have a deterministic node selection policy while dealing with multiple nodes with same deployment.Node selection is only used when discovery yields nodes as a result of its query to locate an Enterprise Bean. If discovery yields a URI or cluster, this mechanism is not used.
- Author:
- Jaikiran Pai, Wolf Dieter Fink
-
-
Field Summary
Fields Modifier and Type Field Description static DeploymentNodeSelectorFIRSTA deployment node selector which prefers the first node always.static DeploymentNodeSelectorRANDOMA deployment node selector which randomly chooses the next node.static DeploymentNodeSelectorRANDOM_PREFER_LOCALA deployment node selector which check the server name if inside and prefer it if available for selection.static DeploymentNodeSelectorROUND_ROBINA deployment node selector which uses an approximate round-robin policy among all of the eligible nodes.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DeploymentNodeSelectorfavorite(Collection<String> favorites, DeploymentNodeSelector fallback)Create a deployment node selector that prefers one or more favorite nodes, falling back to another selector if none of the favorites are found.StringselectNode(String[] eligibleNodes, String appName, String moduleName, String distinctName)Selects and returns a node from among theeligibleNodesto handle the invocation on a deployment represented by the passedappName,moduleNameanddistinctNamecombination.
-
-
-
Field Detail
-
FIRST
static final DeploymentNodeSelector FIRST
A deployment node selector which prefers the first node always. This will generally avoid load balancing in most cases.
-
RANDOM
static final DeploymentNodeSelector RANDOM
A deployment node selector which randomly chooses the next node. This will generally provide the best possible load balancing over a large number of requests.
-
ROUND_ROBIN
static final DeploymentNodeSelector ROUND_ROBIN
A deployment node selector which uses an approximate round-robin policy among all of the eligible nodes. Note that the round-robin node count may be shared among multiple node sets, thus certain specific usage patterns may defeat the round-robin behavior.
-
RANDOM_PREFER_LOCAL
static final DeploymentNodeSelector RANDOM_PREFER_LOCAL
A deployment node selector which check the server name if inside and prefer it if available for selection.
-
-
Method Detail
-
selectNode
String selectNode(String[] eligibleNodes, String appName, String moduleName, String distinctName)
Selects and returns a node from among theeligibleNodesto handle the invocation on a deployment represented by the passedappName,moduleNameanddistinctNamecombination. Implementations of this method must not return null or any other node name which isn't in theeligibleNodes- Parameters:
eligibleNodes- the eligible nodes which can handle the deployment; notnull, will not be emptyappName- the app name of the deploymentmoduleName- the module name of the deploymentdistinctName- the distinct name of the deployment- Returns:
- the node selection (must not be
null)
-
favorite
static DeploymentNodeSelector favorite(Collection<String> favorites, DeploymentNodeSelector fallback)
Create a deployment node selector that prefers one or more favorite nodes, falling back to another selector if none of the favorites are found.- Parameters:
favorites- the favorite nodes, in decreasing order of preference (must not benull)fallback- the fallback selector (must not benull)- Returns:
- the selector (not
null)
-
-