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

x33g5p2x  于2022-01-18 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(155)

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

Cluster.<init>介绍

[英]Constructs a new Cluster instance.

This constructor is mainly exposed so Cluster can be sub-classed as a means to make testing/mocking easier or to "intercept" its method call. Most users shouldn't extend this class however and should prefer using the #builder.
[中]构造一个新的集群实例。
这个构造函数主要是公开的,所以可以将集群划分为子类,以使测试/模拟更容易或“拦截”其方法调用。但是,大多数用户不应该扩展此类,而应该更喜欢使用#builder。

代码示例

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

/**
 * Build a new cluster based on the provided initializer.
 *
 * <p>Note that for building a cluster pragmatically, Cluster.Builder provides a slightly less
 * verbose shortcut with {@link Builder#build}.
 *
 * <p>Also note that that all the contact points provided by {@code initializer} must share the
 * same port.
 *
 * @param initializer the Cluster.Initializer to use
 * @return the newly created Cluster instance
 * @throws IllegalArgumentException if the list of contact points provided by {@code initializer}
 *     is empty or if not all those contact points have the same port.
 */
public static Cluster buildFrom(Initializer initializer) {
 return new Cluster(initializer);
}

代码示例来源:origin: stackoverflow.com

...
Configuration conf = getConf();
Job job = Job.getInstance(new Cluster(conf), conf);

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

/**
 * Build a new cluster based on the provided initializer.
 * <p/>
 * Note that for building a cluster pragmatically, Cluster.Builder
 * provides a slightly less verbose shortcut with {@link Builder#build}.
 * <p/>
 * Also note that that all the contact points provided by {@code
 * initializer} must share the same port.
 *
 * @param initializer the Cluster.Initializer to use
 * @return the newly created Cluster instance
 * @throws IllegalArgumentException if the list of contact points provided
 *                                  by {@code initializer} is empty or if not all those contact points have the same port.
 */
public static Cluster buildFrom(Initializer initializer) {
  return new Cluster(initializer);
}

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

/**
 * Build a new cluster based on the provided initializer.
 * <p/>
 * Note that for building a cluster pragmatically, Cluster.Builder
 * provides a slightly less verbose shortcut with {@link Builder#build}.
 * <p/>
 * Also note that that all the contact points provided by {@code
 * initializer} must share the same port.
 *
 * @param initializer the Cluster.Initializer to use
 * @return the newly created Cluster instance
 * @throws IllegalArgumentException if the list of contact points provided
 *                                  by {@code initializer} is empty or if not all those contact points have the same port.
 */
public static Cluster buildFrom(Initializer initializer) {
  return new Cluster(initializer);
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

/**
 * Build a new cluster based on the provided initializer.
 * <p/>
 * Note that for building a cluster pragmatically, Cluster.Builder
 * provides a slightly less verbose shortcut with {@link Builder#build}.
 * <p/>
 * Also note that that all the contact points provided by {@code
 * initializer} must share the same port.
 *
 * @param initializer the Cluster.Initializer to use
 * @return the newly created Cluster instance
 * @throws IllegalArgumentException if the list of contact points provided
 *                                  by {@code initializer} is empty or if not all those contact points have the same port.
 */
public static Cluster buildFrom(Initializer initializer) {
  return new Cluster(initializer);
}

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

/**
 * Build a new cluster based on the provided initializer.
 * <p>
 * Note that for building a cluster pragmatically, Cluster.Builder
 * provides a slightly less verbose shortcut with {@link Builder#build}.
 * <p>
 * Also note that that all the contact points provided by {@code
 * initializer} must share the same port.
 *
 * @param initializer the Cluster.Initializer to use
 * @return the newly created Cluster instance
 *
 * @throws IllegalArgumentException if the list of contact points provided
 * by {@code initializer} is empty or if not all those contact points have the same port.
 */
public static Cluster buildFrom(Initializer initializer) {
  return new Cluster(initializer);
}

代码示例来源:origin: stackoverflow.com

...
@Deprecated
public Job() throws IOException {
 this(new Configuration());
}
@Deprecated
public Job(Configuration conf) throws IOException {
 this(new Cluster(conf), conf);
}
@Deprecated
public Job(Configuration conf, String jobName) throws IOException {
 this(conf);
 setJobName(jobName);
}
Job(Cluster cluster) throws IOException {
 this(cluster, new Configuration());
}
Job(Cluster cluster, Configuration conf) throws IOException {
 super(conf, null);
 this.cluster = cluster;
}
...
public static Job getInstance(Cluster cluster, Configuration conf) 
  throws IOException {
 return new Job(cluster, conf);
}

代码示例来源:origin: stackoverflow.com

public void testEmpty()
  final Cluster c1 = new Cluster();
  final Cluster c2 = new Cluster();
  Assert.assertEquals(c1, c2);
  Assert.assertEquals(c1.hashCode(), c2.hashCode());
  final Cluster cluster1 = new Cluster();
  cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  pay1.coalitions.add(cluster1);
  final Cluster cluster1 = new Cluster();
  cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  pay1.coalitions.add(cluster1);
  final Cluster cluster2 = new Cluster();
  cluster2.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  pay2.coalitions.add(cluster2);
  final Cluster cluster1 = new Cluster();
  cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  final double[] a1 = {1.5};
  final Cluster cluster2 = new Cluster();
  final double[] a2 = {1.5};
  cluster2.ch = a2;

代码示例来源:origin: stackoverflow.com

@Override
 public void setup(Context context) throws IOException, InterruptedException{
   Configuration conf = context.getConfiguration();
   Cluster cluster = new Cluster(conf);
   Job currentJob = cluster.getJob(context.getJobID());
   mapperCounter = currentJob.getCounters().findCounter(COUNTER_NAME).getValue();  
 }

代码示例来源:origin: stackoverflow.com

public long getInputGroups(String jobId, Configuration conf) {
  Cluster cluster = new Cluster(conf);
  Job job = cluster.getJob(JobID.forName(jobId));
  Counters counters = job.getCounters();
  Counter counter = counters.findCounter("org.apache.hadoop.mapred.Task$Counter","REDUCE_I‌​NPUT_GROUPS");
  return counter.getValue();
}

代码示例来源:origin: stackoverflow.com

@Override
 public void setup(Context context) throws IOException, InterruptedException{
   Configuration conf = context.getConfiguration();
   Cluster cluster = new Cluster(conf);
   Job currentJob = cluster.getJob(context.getJobID());
   mapperCounter = currentJob.getCounters().findCounter(COUNTER_NAME).getValue();  
 }

相关文章