A load balancing policy wrapper that ensure that only hosts from a provided allow list will ever be returned.

This policy wraps another load balancing policy and will delegate the choice of hosts to the wrapped policy with the exception that only hosts contained in the allow list provided when constructing this policy will ever be returned. Any host not in the while list will be considered ignored and thus will not be connected to.

This policy can be useful to ensure that the driver only connects to a predefined set of hosts. Keep in mind however that this policy defeats somewhat the host auto-detection of the driver. As such, this policy is only useful in a few special cases or for testing, but is not optimal in general. If all you want to do is limiting connections to hosts of the local data-center then you should use DCAwareRoundRobinPolicy and not this policy in particular.


  • LoadBalancingPolicy




(LoadBalancingPolicy childPolicy, Array<string> allowList)

Create a new policy that wraps the provided child policy but only “allow” hosts from the provided list.

Name Type Description
childPolicy LoadBalancingPolicy

the wrapped policy.

allowList Array<string>

The hosts address in the format ipAddress:port. Only hosts from this list may get connected to (whether they will get connected to or not depends on the child policy).




Uses the child policy to return the distance to the host if included in the allow list. Any host not in the while list will be considered ignored.

Name Type Description



Gets an associative array containing the policy options.



Returns the hosts to use for a new query filtered by the allow list.