Interface FederationPolicyManager

All Known Implementing Classes:
AbstractPolicyManager, HashBroadcastPolicyManager, HomePolicyManager, PriorityBroadcastPolicyManager, RejectAllPolicyManager, UniformBroadcastPolicyManager, WeightedHomePolicyManager, WeightedLocalityPolicyManager

public interface FederationPolicyManager
Implementors need to provide the ability to serialize a policy and its configuration as a SubClusterPolicyConfiguration, as well as provide (re)initialization mechanics for the underlying FederationAMRMProxyPolicy and FederationRouterPolicy. The serialization aspects are used by admin APIs or a policy engine to store a serialized configuration in the FederationStateStore, while the getters methods are used to obtain a properly initialized policy in the Router and AMRMProxy respectively. This interface by design binds together FederationAMRMProxyPolicy and FederationRouterPolicy and provide lifecycle support for serialization and deserialization, to reduce configuration mistakes (combining incompatible policies).
  • Method Details

    • getAMRMPolicy

      If the current instance is compatible, this method returns the same instance of FederationAMRMProxyPolicy reinitialized with the current context, otherwise a new instance initialized with the current context is provided. If the instance is compatible with the current class the implementors should attempt to reinitialize (retaining state). To affect a complete policy reset oldInstance should be null.
      Parameters:
      policyContext - the current context
      oldInstance - the existing (possibly null) instance.
      Returns:
      an updated FederationAMRMProxyPolicy.
      Throws:
      FederationPolicyInitializationException - if the initialization cannot be completed properly. The oldInstance should be still valid in case of failed initialization.
    • getRouterPolicy

      If the current instance is compatible, this method returns the same instance of FederationRouterPolicy reinitialized with the current context, otherwise a new instance initialized with the current context is provided. If the instance is compatible with the current class the implementors should attempt to reinitialize (retaining state). To affect a complete policy reset oldInstance should be set to null.
      Parameters:
      policyContext - the current context
      oldInstance - the existing (possibly null) instance.
      Returns:
      an updated FederationRouterPolicy.
      Throws:
      FederationPolicyInitializationException - if the initialization cannot be completed properly. The oldInstance should be still valid in case of failed initialization.
    • serializeConf

      This method is invoked to derive a SubClusterPolicyConfiguration. This is to be used when writing a policy object in the federation policy store.
      Returns:
      a valid policy configuration representing this object parametrization.
      Throws:
      FederationPolicyInitializationException - if the current state cannot be serialized properly
    • getQueue

      String getQueue()
      This method returns the queue this policy is configured for.
      Returns:
      the name of the queue.
    • setQueue

      void setQueue(String queue)
      This methods provides a setter for the queue this policy is specified for.
      Parameters:
      queue - the name of the queue.
    • getWeightedPolicyInfo

      WeightedPolicyInfo getWeightedPolicyInfo()
      This method returns the queue WeightedPolicyInfo this policy is configured for.
      Returns:
      the name of the queue.
    • setWeightedPolicyInfo

      void setWeightedPolicyInfo(WeightedPolicyInfo weightedPolicyInfo)
      This methods provides a setter for the queue WeightedPolicyInfo this policy is specified for.
      Parameters:
      weightedPolicyInfo - weightedPolicyInfo of the subCluster.
    • isSupportWeightedPolicyInfo

      boolean isSupportWeightedPolicyInfo()
      PolicyManager Whether to support WeightedPolicyInfo. Some of PolicyManagers do not support WeightedPolicyInfo.
      Returns:
      true, supports WeightedPolicyInfo; false, WeightedPolicyInfo is not supported