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 Summary
Modifier and TypeMethodDescriptiongetAMRMPolicy(FederationPolicyInitializationContext policyContext, FederationAMRMProxyPolicy oldInstance) If the current instance is compatible, this method returns the same instance ofFederationAMRMProxyPolicyreinitialized with the current context, otherwise a new instance initialized with the current context is provided.getQueue()This method returns the queue this policy is configured for.getRouterPolicy(FederationPolicyInitializationContext policyContext, FederationRouterPolicy oldInstance) If the current instance is compatible, this method returns the same instance ofFederationRouterPolicyreinitialized with the current context, otherwise a new instance initialized with the current context is provided.This method returns the queue WeightedPolicyInfo this policy is configured for.booleanPolicyManager Whether to support WeightedPolicyInfo.This method is invoked to derive aSubClusterPolicyConfiguration.voidThis methods provides a setter for the queue this policy is specified for.voidsetWeightedPolicyInfo(WeightedPolicyInfo weightedPolicyInfo) This methods provides a setter for the queue WeightedPolicyInfo this policy is specified for.
-
Method Details
-
getAMRMPolicy
FederationAMRMProxyPolicy getAMRMPolicy(FederationPolicyInitializationContext policyContext, FederationAMRMProxyPolicy oldInstance) throws FederationPolicyInitializationException If the current instance is compatible, this method returns the same instance ofFederationAMRMProxyPolicyreinitialized 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 contextoldInstance- 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
FederationRouterPolicy getRouterPolicy(FederationPolicyInitializationContext policyContext, FederationRouterPolicy oldInstance) throws FederationPolicyInitializationException If the current instance is compatible, this method returns the same instance ofFederationRouterPolicyreinitialized 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 contextoldInstance- 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 aSubClusterPolicyConfiguration. 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
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
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
-