gpt4 book ai didi

io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:55:30 28 4
gpt4 key购买 nike

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

ZookeeperClusterManager.<init>介绍

暂无

代码示例

代码示例来源:origin: vert-x3/vertx-examples

public static void main(String[] args) {
  JsonObject zkConfig = configureClusterManager();
  ClusterManager zookeeperClusterManager = new ZookeeperClusterManager(zkConfig);
  VertxOptions options = configureVertx(zookeeperClusterManager);
  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
      DeploymentOptions deploymentOptions = new DeploymentOptions().setInstances(2);
      vertx.deployVerticle("verticle.SenderVerticle", deploymentOptions);
      System.out.println("Sender verticle deployed");
    }
  });
}

代码示例来源:origin: vert-x3/vertx-examples

public static void main(String[] args) {
  JsonObject zkConfig = configureClusterManager();
  ClusterManager zookeeperClusterManager = new ZookeeperClusterManager(zkConfig);
  VertxOptions options = configureVertx(zookeeperClusterManager);
  Vertx.clusteredVertx(options, res -> {
    if (res.succeeded()) {
      Vertx vertx = res.result();
      DeploymentOptions deploymentOptions = new DeploymentOptions().setInstances(2);
      vertx.deployVerticle("verticle.ConsumerVerticle", deploymentOptions);
      System.out.println("consumer verticle deployed");
    }
  });
}

代码示例来源:origin: vert-x3/vertx-zookeeper

public void example1() {
 ClusterManager mgr = new ZookeeperClusterManager();
 VertxOptions options = new VertxOptions().setClusterManager(mgr);
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {
   Vertx vertx = res.result();
  } else {
   // failed!
  }
 });
}

代码示例来源:origin: vert-x3/vertx-zookeeper

public void example2() {
 JsonObject zkConfig = new JsonObject();
 zkConfig.put("zookeeperHosts", "127.0.0.1");
 zkConfig.put("rootPath", "io.vertx");
 zkConfig.put("retry", new JsonObject()
   .put("initialSleepTime", 3000)
   .put("maxTimes", 3));
 ClusterManager mgr = new ZookeeperClusterManager(zkConfig);
 VertxOptions options = new VertxOptions().setClusterManager(mgr);
 Vertx.clusteredVertx(options, res -> {
  if (res.succeeded()) {
   Vertx vertx = res.result();
  } else {
   // failed!
  }
 });
}

代码示例来源:origin: vert-x3/vertx-zookeeper

public void example3(CuratorFramework curator) {
  ClusterManager mgr = new ZookeeperClusterManager(curator);
  VertxOptions options = new VertxOptions().setClusterManager(mgr);
  Vertx.clusteredVertx(options, res -> {
   if (res.succeeded()) {
    Vertx vertx = res.result();
   } else {
    // failed!
   }
  });
 }
}

代码示例来源:origin: io.vertx/vertx-zookeeper

@Test
public void testCustomCuratorFramework() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 CuratorFramework curator = CuratorFrameworkFactory.builder()
  .connectString(config.getString("zookeeperHosts"))
  .namespace(config.getString("rootPath"))
  .retryPolicy(retryPolicy).build();
 curator.start();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager(curator);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: vert-x3/vertx-zookeeper

@Test
public void testCustomCuratorFramework() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 CuratorFramework curator = CuratorFrameworkFactory.builder()
  .connectString(config.getString("zookeeperHosts"))
  .namespace(config.getString("rootPath"))
  .retryPolicy(retryPolicy).build();
 curator.start();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager(curator);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: io.vertx/vertx-zookeeper

public ClusterManager getClusterManager() {
  CuratorFramework curator = CuratorFrameworkFactory.builder()
   .namespace("io.vertx")
   .sessionTimeoutMs(3000)
   .connectionTimeoutMs(1000)
   .connectString(server.getConnectString())
   .retryPolicy(retryPolicy).build();
  curator.start();
  //there is take up time for zk client thread start up.
  while (curator.getState() != CuratorFrameworkState.STARTED) {
   try {
    Thread.sleep(100);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
  }
  ZookeeperClusterManager zookeeperClusterManager = new ZookeeperClusterManager(retryPolicy, curator);
  clusterManagers.add(zookeeperClusterManager);
  return zookeeperClusterManager;
 }
}

代码示例来源:origin: vert-x3/vertx-zookeeper

public ClusterManager getClusterManager() {
  CuratorFramework curator = CuratorFrameworkFactory.builder()
   .namespace("io.vertx")
   .sessionTimeoutMs(3000)
   .connectionTimeoutMs(1000)
   .connectString(server.getConnectString())
   .retryPolicy(retryPolicy).build();
  curator.start();
  //there is take up time for zk client thread start up.
  while (curator.getState() != CuratorFrameworkState.STARTED) {
   try {
    Thread.sleep(100);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
  }
  ZookeeperClusterManager zookeeperClusterManager = new ZookeeperClusterManager(retryPolicy, curator);
  clusterManagers.add(zookeeperClusterManager);
  return zookeeperClusterManager;
 }
}

代码示例来源:origin: vert-x3/vertx-zookeeper

@Test
public void testProgrammaticSetWithConstructor() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager(config);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: io.vertx/vertx-zookeeper

@Test
public void testProgrammaticSetWithConstructor() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager(config);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: vert-x3/vertx-zookeeper

@Test
public void testProgrammaticSetConfig() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager();
 mgr.setConfig(config);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: io.vertx/vertx-zookeeper

@Test
public void testProgrammaticSetConfig() throws Exception {
 JsonObject config = zkCluster.getDefaultConfig();
 ZookeeperClusterManager mgr = new ZookeeperClusterManager();
 mgr.setConfig(config);
 testProgrammatic(mgr, config);
}

代码示例来源:origin: io.vertx/vertx-zookeeper

String nodeID = UUID.randomUUID().toString();
ZookeeperClusterManager mgr = new ZookeeperClusterManager(curator, nodeID);
VertxOptions options = new VertxOptions().setClusterManager(mgr).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: vert-x3/vertx-zookeeper

String nodeID = UUID.randomUUID().toString();
ZookeeperClusterManager mgr = new ZookeeperClusterManager(curator, nodeID);
VertxOptions options = new VertxOptions().setClusterManager(mgr).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: vert-x3/vertx-zookeeper

curator2.start();
ZookeeperClusterManager mgr1 = new ZookeeperClusterManager(curator1);
ZookeeperClusterManager mgr2 = new ZookeeperClusterManager(curator2);
VertxOptions options1 = new VertxOptions().setClusterManager(mgr1).setClustered(true).setClusterHost("127.0.0.1");
VertxOptions options2 = new VertxOptions().setClusterManager(mgr2).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: io.vertx/vertx-zookeeper

curator2.start();
ZookeeperClusterManager mgr1 = new ZookeeperClusterManager(curator1);
ZookeeperClusterManager mgr2 = new ZookeeperClusterManager(curator2);
VertxOptions options1 = new VertxOptions().setClusterManager(mgr1).setClustered(true).setClusterHost("127.0.0.1");
VertxOptions options2 = new VertxOptions().setClusterManager(mgr2).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: vert-x3/vertx-zookeeper

curator2.start();
ZookeeperClusterManager mgr1 = new ZookeeperClusterManager(curator1);
ZookeeperClusterManager mgr2 = new ZookeeperClusterManager(curator2);
VertxOptions options1 = new VertxOptions().setClusterManager(mgr1).setClustered(true).setClusterHost("127.0.0.1");
VertxOptions options2 = new VertxOptions().setClusterManager(mgr2).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: io.vertx/vertx-zookeeper

curator2.start();
ZookeeperClusterManager mgr1 = new ZookeeperClusterManager(curator1);
ZookeeperClusterManager mgr2 = new ZookeeperClusterManager(curator2);
VertxOptions options1 = new VertxOptions().setClusterManager(mgr1).setClustered(true).setClusterHost("127.0.0.1");
VertxOptions options2 = new VertxOptions().setClusterManager(mgr2).setClustered(true).setClusterHost("127.0.0.1");

代码示例来源:origin: io.vertx/vertx-zookeeper

curator2.start();
ZookeeperClusterManager mgr1 = new ZookeeperClusterManager(curator1);
ZookeeperClusterManager mgr2 = new ZookeeperClusterManager(curator2);
VertxOptions options1 = new VertxOptions().setClusterManager(mgr1).setClustered(true).setClusterHost("127.0.0.1");
VertxOptions options2 = new VertxOptions().setClusterManager(mgr2).setClustered(true).setClusterHost("127.0.0.1");

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com