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

    Fields
    Modifier and Type
    Field
    Description
    A deployment node selector which prefers the first node always.
    A deployment node selector which randomly chooses the next node.
    A deployment node selector which check the server name if inside and prefer it if available for selection.
    A deployment node selector which uses an approximate round-robin policy among all of the eligible nodes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a deployment node selector that prefers one or more favorite nodes, falling back to another selector if none of the favorites are found.
    selectNode(String[] eligibleNodes, String appName, String moduleName, String distinctName)
    Selects and returns a node from among the eligibleNodes to handle the invocation on a deployment represented by the passed appName, moduleName and distinctName combination.
  • Field Details

    • 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 Details

    • selectNode

      String selectNode(String[] eligibleNodes, String appName, String moduleName, String distinctName)
      Selects and returns a node from among the eligibleNodes to handle the invocation on a deployment represented by the passed appName, moduleName and distinctName combination. Implementations of this method must not return null or any other node name which isn't in the eligibleNodes
      Parameters:
      eligibleNodes - the eligible nodes which can handle the deployment; not null, will not be empty
      appName - the app name of the deployment
      moduleName - the module name of the deployment
      distinctName - 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 be null)
      fallback - the fallback selector (must not be null)
      Returns:
      the selector (not null)