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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Build a new cluster based on the provided initializer.
  3. * <p>
  4. * Note that for building a cluster pragmatically, Cluster.Builder
  5. * provides a slightly less verbose shortcut with {@link Builder#build}.
  6. * <p>
  7. * Also note that that all the contact points provided by {@code
  8. * initializer} must share the same port.
  9. *
  10. * @param initializer the Cluster.Initializer to use
  11. * @return the newly created Cluster instance
  12. *
  13. * @throws IllegalArgumentException if the list of contact points provided
  14. * by {@code initializer} is empty or if not all those contact points have the same port.
  15. */
  16. public static Cluster buildFrom(Initializer initializer) {
  17. return new Cluster(initializer);
  18. }

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

  1. ...
  2. @Deprecated
  3. public Job() throws IOException {
  4. this(new Configuration());
  5. }
  6. @Deprecated
  7. public Job(Configuration conf) throws IOException {
  8. this(new Cluster(conf), conf);
  9. }
  10. @Deprecated
  11. public Job(Configuration conf, String jobName) throws IOException {
  12. this(conf);
  13. setJobName(jobName);
  14. }
  15. Job(Cluster cluster) throws IOException {
  16. this(cluster, new Configuration());
  17. }
  18. Job(Cluster cluster, Configuration conf) throws IOException {
  19. super(conf, null);
  20. this.cluster = cluster;
  21. }
  22. ...
  23. public static Job getInstance(Cluster cluster, Configuration conf)
  24. throws IOException {
  25. return new Job(cluster, conf);
  26. }

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

  1. public void testEmpty()
  2. final Cluster c1 = new Cluster();
  3. final Cluster c2 = new Cluster();
  4. Assert.assertEquals(c1, c2);
  5. Assert.assertEquals(c1.hashCode(), c2.hashCode());
  6. final Cluster cluster1 = new Cluster();
  7. cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  8. pay1.coalitions.add(cluster1);
  9. final Cluster cluster1 = new Cluster();
  10. cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  11. pay1.coalitions.add(cluster1);
  12. final Cluster cluster2 = new Cluster();
  13. cluster2.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  14. pay2.coalitions.add(cluster2);
  15. final Cluster cluster1 = new Cluster();
  16. cluster1.dataArray.addAll(java.util.Arrays.asList(1,2,3));
  17. final double[] a1 = {1.5};
  18. final Cluster cluster2 = new Cluster();
  19. final double[] a2 = {1.5};
  20. cluster2.ch = a2;

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

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

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

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

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

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

相关文章