Package org.jboss.ejb.client
Interface DeploymentNodeSelector
public interface DeploymentNodeSelector
A 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 of
DeploymentNodeSelector involves 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
FieldsModifier and TypeFieldDescriptionstatic final DeploymentNodeSelectorA deployment node selector which prefers the first node always.static final DeploymentNodeSelectorA deployment node selector which randomly chooses the next node.static final DeploymentNodeSelectorA deployment node selector which check the server name if inside and prefer it if available for selection.static final DeploymentNodeSelectorA deployment node selector which uses an approximate round-robin policy among all of the eligible nodes. -
Method Summary
Modifier and TypeMethodDescriptionstatic DeploymentNodeSelectorfavorite(Collection<String> favorites, DeploymentNodeSelector fallback) Deprecated.will be removed in future versionselectNode(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 Details
-
FIRST
A deployment node selector which prefers the first node always. This will generally avoid load balancing in most cases. -
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
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
A deployment node selector which check the server name if inside and prefer it if available for selection.
-
-
Method Details
-
selectNode
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
@Deprecated static DeploymentNodeSelector favorite(Collection<String> favorites, DeploymentNodeSelector fallback) Deprecated.will be removed in future versionCreate 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)
-