Thanks Carlo Curino,
Some questions / comments:
1) Who will consume AMRMProxyFederationPolicy and RouterFederationPolicy? I'm not be able to figure it out from the patch, I guess AMRMProxyService will use them, is it correct?
2) It looks like FederationPolicy is more like a FederationConfigurator/Creator, is it better to remove the FederationPolicy interface? We can either make FederationPolicyConfigurator extends FederationPolicyWriter or let implementation decide which to implement (such as SimpleFederationPolicyConfiguratorImpl implements FederationPolicyWriter, FederationPolicyConfigurator).
3) Is it better to rename FederationPolicyContext to FederationPolicyInitializationContext?
4) The name "router" is a little hard to be understood, now it only determines application's home sub cluster while submitting the app, do you plan to add more functionalities to the module? Do you think is it better to rename it to be "AMRMProxyHomeClusterPolicy", (and similarly we may rename AMRMProxyFederationPolicy to AMRMProxyResourceRequestPolicy).