Java Code Examples for com.datastax.driver.core.HostDistance#LOCAL

The following examples show how to use com.datastax.driver.core.HostDistance#LOCAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LimitedLocalNodeFirstLocalBalancingPolicy.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
@Override
public HostDistance distance(Host host)
{
    if (isLocalHost(host))
    {
        return HostDistance.LOCAL;
    }
    else
    {
        return HostDistance.REMOTE;
    }
}
 
Example 2
Source File: LocalMachineLoadBalancingPolicy.java    From deep-spark with Apache License 2.0 2 votes vote down vote up
/**
 * Return the HostDistance for the provided host.
 * <p/>
 * This policy consider all nodes as local. This is generally the right
 * thing to do in a single datacenter deployment. If you use multiple
 * datacenter, see {@link com.datastax.driver.core.policies.DCAwareRoundRobinPolicy} instead.
 *
 * @param host the host of which to return the distance of.
 * @return the HostDistance to {@code host}.
 */
@Override
public HostDistance distance(Host host) {
    return HostDistance.LOCAL;
}