public class WhiteListPolicy extends HostFilterPolicy
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.HostFilterPolicy
Constructor and Description |
---|
WhiteListPolicy(LoadBalancingPolicy childPolicy,
Collection<InetSocketAddress> whiteList)
Creates a new policy that wraps the provided child policy but only "allows" hosts
from the provided while list.
|
close, distance, fromDCBlackList, fromDCWhiteList, getChildPolicy, init, newQueryPlan, onAdd, onDown, onRemove, onSuspected, onUp
public WhiteListPolicy(LoadBalancingPolicy childPolicy, Collection<InetSocketAddress> whiteList)
childPolicy
- the wrapped policy.whiteList
- the white listed hosts. Only hosts from this list may get connected
to (whether they will get connected to or not depends on the child policy).