Package org.jboss.ejb.client
Interface DiscoveredURISelector
-
public interface DiscoveredURISelector
A selector which selects and returns a URI, from among the passed eligible URIs, that can handle a specific deployment within a EJB client context. Typical usage ofDiscoveredURISelector
involves load balancing calls to multiple targets which can all handle the same deployment. This allows the application to have a deterministic target selection policy while dealing with multiple targets with same deployment.Target selection is only used when discovery yields more than one URI as a result of its query to locate an EJB.
- Author:
- David M. Lloyd, Jaikiran Pai
-
-
Field Summary
Fields Modifier and Type Field Description static DiscoveredURISelector
FIRST
A deployment URI selector which prefers the first URI always.static DiscoveredURISelector
RANDOM
A deployment URI selector which randomly chooses the next URI.static DiscoveredURISelector
ROUND_ROBIN
A deployment URI selector which uses an approximate round-robin policy among all of the eligible URIs.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DiscoveredURISelector
favorite(Collection<URI> favorites, DiscoveredURISelector fallback)
Create a deployment URI selector that prefers one or more favorite nodes, falling back to another selector if none of the favorites are found.URI
selectNode(List<URI> eligibleUris, EJBLocator<?> locator)
Selects and returns a URI from among theeligibleUris
to handle the invocation on a deployment represented by the passed inlocator
.
-
-
-
Field Detail
-
FIRST
static final DiscoveredURISelector FIRST
A deployment URI selector which prefers the first URI always. This will generally avoid load balancing in most cases.
-
RANDOM
static final DiscoveredURISelector RANDOM
A deployment URI selector which randomly chooses the next URI. This will generally provide the best possible load balancing over a large number of requests.
-
ROUND_ROBIN
static final DiscoveredURISelector ROUND_ROBIN
A deployment URI selector which uses an approximate round-robin policy among all of the eligible URIs. Note that the round-robin URI count may be shared among multiple node sets, thus certain specific usage patterns may defeat the round-robin behavior.
-
-
Method Detail
-
selectNode
URI selectNode(List<URI> eligibleUris, EJBLocator<?> locator)
Selects and returns a URI from among theeligibleUris
to handle the invocation on a deployment represented by the passed inlocator
. Implementations of this method must not returnnull
or any other node name which isn't in theeligibleUris
list.Note that the list sent in for
eligibleUris
is indexed, meaning that thecontains
operation is guaranteed to run in constant time.- Parameters:
eligibleUris
- an indexed list of the eligible nodes which can handle the deployment; notnull
, will not be emptylocator
- the locator of the EJB being invoked upon- Returns:
- the URI selection (must not be
null
, must be one of the URIs fromeligibleUris
)
-
favorite
static DiscoveredURISelector favorite(Collection<URI> favorites, DiscoveredURISelector fallback)
Create a deployment URI 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
)
-
-