com.datastax.driver.core.policies.WhiteListPolicy.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中com.datastax.driver.core.policies.WhiteListPolicy.<init>()方法的一些代码示例,展示了WhiteListPolicy.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteListPolicy.<init>()方法的具体详情如下:
包路径:com.datastax.driver.core.policies.WhiteListPolicy
类名称:WhiteListPolicy
方法名:<init>

WhiteListPolicy.<init>介绍

[英]Private constructor solely for maintaining type from policy created by #ofHosts(LoadBalancingPolicy,String...).
[中]专用构造函数,仅用于维护由#of hosts(LoadBalancingPolicy,String…)创建的策略中的类型。

代码示例

代码示例来源:origin: prestodb/presto

whiteList.add(new InetSocketAddress(point, config.getNativeProtocolPort()));
loadPolicy = new WhiteListPolicy(loadPolicy, whiteList);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

return new WhiteListPolicy(
  childPolicy,
  new Predicate<Host>() {

代码示例来源:origin: Impetus/Kundera

loadBalancingPolicy = new WhiteListPolicy(loadBalancingPolicy, whiteListCollection);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

@Override
public Cluster.Builder createClusterBuilder() {
 // Only connect to node 1, which makes it easier to query system tables in
 // should_expose_tokens_per_host()
 LoadBalancingPolicy lbp =
   new WhiteListPolicy(new RoundRobinPolicy(), Collections.singleton(ccm().addressOfNode(1)));
 return Cluster.builder()
   .addContactPoints(getContactPoints().get(0))
   .withPort(ccm().getBinaryPort())
   .withLoadBalancingPolicy(lbp);
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

/**
 * @return a {@link Cluster} instance that connects only to the control host of the given cluster.
 */
public static Cluster buildControlCluster(Cluster cluster, CCMAccess ccm) {
 Host controlHost = cluster.manager.controlConnection.connectedHost();
 List<InetSocketAddress> singleAddress =
   Collections.singletonList(controlHost.getSocketAddress());
 return Cluster.builder()
   .addContactPoints(controlHost.getSocketAddress().getAddress())
   .withPort(ccm.getBinaryPort())
   .withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), singleAddress))
   .build();
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

private void deleteNode2RpcAddressFromNode1() throws Exception {
  InetSocketAddress firstHost = ccm().addressOfNode(1);
  Cluster cluster =
    register(
      Cluster.builder()
        .addContactPoints(firstHost.getAddress())
        .withPort(ccm().getBinaryPort())
        // ensure we will only connect to node1
        .withLoadBalancingPolicy(
          new WhiteListPolicy(
            Policies.defaultLoadBalancingPolicy(), Lists.newArrayList(firstHost)))
        .build());
  Session session = cluster.connect();
  String deleteStmt =
    String.format(
      "DELETE rpc_address FROM system.peers WHERE peer = '%s'",
      ccm().addressOfNode(2).getHostName());
  session.execute(deleteStmt);
  session.close();
  cluster.close();
 }
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_rethrow_unavailable_in_no_host_available_exception() {
 LoadBalancingPolicy firstHostOnlyPolicy =
   new WhiteListPolicy(
     Policies.defaultLoadBalancingPolicy(),
     Collections.singletonList(host1.getSocketAddress()));

代码示例来源:origin: composable-systems/dropwizard-cassandra

@Override
  public LoadBalancingPolicy build() {
    return new WhiteListPolicy(subPolicy.build(), whiteList);
  }
}

代码示例来源:origin: systems.composable/dropwizard-cassandra

@Override
  public LoadBalancingPolicy build() {
    return new WhiteListPolicy(subPolicy.build(), whiteList);
  }
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

.addContactPointsWithPorts(sCluster.address(3))
.withPort(sCluster.getBinaryPort())
.withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), whiteList))
.withNettyOptions(nonQuietClusterCloseOptions)
.build();

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

.addContactPoints(sCluster.address(5).getAddress())
.withPort(sCluster.getBinaryPort())
.withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), whiteList))
.withNettyOptions(nonQuietClusterCloseOptions)
.build();

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

@Override
public Cluster.Builder createClusterBuilder() {
 // Only connect to node 1, which makes it easier to query system tables in
 // should_expose_tokens_per_host()
 LoadBalancingPolicy lbp =
   new WhiteListPolicy(new RoundRobinPolicy(), Collections.singleton(ccm().addressOfNode(1)));
 return Cluster.builder()
   .addContactPoints(getContactPoints().get(0))
   .withPort(ccm().getBinaryPort())
   .withLoadBalancingPolicy(lbp);
}

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

/**
 * @return a {@link Cluster} instance that connects only to the control host of the given cluster.
 */
public static Cluster buildControlCluster(Cluster cluster, CCMAccess ccm) {
 Host controlHost = cluster.manager.controlConnection.connectedHost();
 List<InetSocketAddress> singleAddress =
   Collections.singletonList(controlHost.getSocketAddress());
 return Cluster.builder()
   .addContactPoints(controlHost.getSocketAddress().getAddress())
   .withPort(ccm.getBinaryPort())
   .withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), singleAddress))
   .build();
}

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

private void deleteNode2RpcAddressFromNode1() throws Exception {
  InetSocketAddress firstHost = ccm().addressOfNode(1);
  Cluster cluster =
    register(
      Cluster.builder()
        .addContactPoints(firstHost.getAddress())
        .withPort(ccm().getBinaryPort())
        // ensure we will only connect to node1
        .withLoadBalancingPolicy(
          new WhiteListPolicy(
            Policies.defaultLoadBalancingPolicy(), Lists.newArrayList(firstHost)))
        .build());
  Session session = cluster.connect();
  String deleteStmt =
    String.format(
      "DELETE rpc_address FROM system.peers WHERE peer = '%s'",
      ccm().addressOfNode(2).getHostName());
  session.execute(deleteStmt);
  session.close();
  cluster.close();
 }
}

代码示例来源:origin: com.facebook.presto/presto-cassandra

whiteList.add(new InetSocketAddress(point, config.getNativeProtocolPort()));
loadPolicy = new WhiteListPolicy(loadPolicy, whiteList);

代码示例来源:origin: prestosql/presto

whiteList.add(new InetSocketAddress(point, config.getNativeProtocolPort()));
loadPolicy = new WhiteListPolicy(loadPolicy, whiteList);

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

@Test(groups = "short")
public void should_rethrow_unavailable_in_no_host_available_exception() {
 LoadBalancingPolicy firstHostOnlyPolicy =
   new WhiteListPolicy(
     Policies.defaultLoadBalancingPolicy(),
     Collections.singletonList(host1.getSocketAddress()));

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

.addContactPointsWithPorts(sCluster.address(3))
.withPort(sCluster.getBinaryPort())
.withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), whiteList))
.withNettyOptions(nonQuietClusterCloseOptions)
.build();

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

.addContactPoints(sCluster.address(5).getAddress())
.withPort(sCluster.getBinaryPort())
.withLoadBalancingPolicy(new WhiteListPolicy(new RoundRobinPolicy(), whiteList))
.withNettyOptions(nonQuietClusterCloseOptions)
.build();

相关文章