case "clusterHost": if (member.getValue() instanceof String) { obj.setClusterHost((String)member.getValue());
AtomicReference<AsyncResult<Vertx>> result = new AtomicReference<>(); options.setClusterHost(clusterHost).setClusterPort(clusterPort).setClustered(true); if (ha) { String haGroup = args.map.get("-hagroup");
@Test public void testCallbackInvokedOnFailure() throws Exception { // will trigger java.net.UnknownHostException String hostName = "zoom.zoom.zen.tld"; VertxOptions options = new VertxOptions() .setClusterManager(new FakeClusterManager()) .setClusterHost(hostName); AtomicReference<AsyncResult<Vertx>> resultRef = new AtomicReference<>(); CountDownLatch latch = new CountDownLatch(1); Vertx.clusteredVertx(options, ar -> { resultRef.set(ar); latch.countDown(); }); awaitLatch(latch); assertFalse(resultRef.get() == null); assertTrue(resultRef.get().failed()); assertTrue("Was expecting failure to be an instance of UnknownHostException", resultRef.get().cause() instanceof UnknownHostException); } }
protected void startNodes(int numNodes, VertxOptions options) { CountDownLatch latch = new CountDownLatch(numNodes); vertices = new Vertx[numNodes]; for (int i = 0; i < numNodes; i++) { int index = i; clusteredVertx(options.setClusterHost("localhost").setClusterPort(0).setClustered(true) .setClusterManager(getClusterManager()), ar -> { try { if (ar.failed()) { ar.cause().printStackTrace(); } assertTrue("Failed to start node", ar.succeeded()); vertices[index] = ar.result(); } finally { latch.countDown(); } }); } try { assertTrue(latch.await(2, TimeUnit.MINUTES)); } catch (InterruptedException e) { fail(e.getMessage()); } }
protected Vertx startVertx(String haGroup, int quorumSize, boolean ha) throws Exception { VertxOptions options = new VertxOptions().setHAEnabled(ha).setClustered(true). setClusterHost("localhost").setClusterManager(getClusterManager()); if (ha) { options.setQuorumSize(quorumSize); if (haGroup != null) { options.setHAGroup(haGroup); } } CountDownLatch latch = new CountDownLatch(1); AtomicReference<Vertx> vertxRef = new AtomicReference<>(); clusteredVertx(options, onSuccess(vertx -> { vertxRef.set(vertx); latch.countDown(); })); latch.await(2, TimeUnit.MINUTES); return vertxRef.get(); }
@Override public void beforeStartingVertx(VertxOptions options) { beforeStartingVertxInvoked = true; this.options = options; if (clusterHost != null) { options.setClusterHost(clusterHost); options.setClusterPort(clusterPort); options.setClusterPublicHost(clusterPublicHost); options.setClusterPublicPort(clusterPublicPort); super.beforeStartingVertx(options); } }
.setClusterHost(clusterHost).setClusterPort(clusterPort) .setClusterPublicHost(clusterPublicHost); if (clusterPublicPort != -1) {
case "clusterHost": if (member.getValue() instanceof String) { obj.setClusterHost((String)member.getValue());
AtomicReference<AsyncResult<Vertx>> result = new AtomicReference<>(); options.setClusterHost(clusterHost).setClusterPort(clusterPort).setClustered(true); if (ha) { String haGroup = args.map.get("-hagroup");
options.setWorkerPoolSize(workerPoolSize); options.setBlockedThreadCheckInterval(blockedThreadCheckInterval); options.setClusterHost(clusterHost); options.setClusterPublicHost(clusterPublicHost); options.setClusterPingInterval(clusterPingInterval);
@Test public void testCallbackInvokedOnFailure() throws Exception { // will trigger java.net.UnknownHostException String hostName = "zoom.zoom.zen.tld"; VertxOptions options = new VertxOptions() .setClusterManager(new FakeClusterManager()) .setClusterHost(hostName); AtomicReference<AsyncResult<Vertx>> resultRef = new AtomicReference<>(); CountDownLatch latch = new CountDownLatch(1); Vertx.clusteredVertx(options, ar -> { resultRef.set(ar); latch.countDown(); }); awaitLatch(latch); assertFalse(resultRef.get() == null); assertTrue(resultRef.get().failed()); assertTrue("Was expecting failure to be an instance of UnknownHostException", resultRef.get().cause() instanceof UnknownHostException); } }
protected void startNodes(int numNodes, VertxOptions options) { CountDownLatch latch = new CountDownLatch(numNodes); vertices = new Vertx[numNodes]; for (int i = 0; i < numNodes; i++) { int index = i; clusteredVertx(options.setClusterHost("localhost").setClusterPort(0).setClustered(true) .setClusterManager(getClusterManager()), ar -> { try { if (ar.failed()) { ar.cause().printStackTrace(); } assertTrue("Failed to start node", ar.succeeded()); vertices[index] = ar.result(); } finally { latch.countDown(); } }); } try { assertTrue(latch.await(2, TimeUnit.MINUTES)); } catch (InterruptedException e) { fail(e.getMessage()); } }
protected Vertx startVertx(String haGroup, int quorumSize, boolean ha) throws Exception { VertxOptions options = new VertxOptions().setHAEnabled(ha).setClustered(true). setClusterHost("localhost").setClusterManager(getClusterManager()); if (ha) { options.setQuorumSize(quorumSize); if (haGroup != null) { options.setHAGroup(haGroup); } } CountDownLatch latch = new CountDownLatch(1); AtomicReference<Vertx> vertxRef = new AtomicReference<>(); clusteredVertx(options, onSuccess(vertx -> { vertxRef.set(vertx); latch.countDown(); })); latch.await(2, TimeUnit.MINUTES); return vertxRef.get(); }
@Override public void beforeStartingVertx(VertxOptions options) { beforeStartingVertxInvoked = true; this.options = options; if (clusterHost != null) { options.setClusterHost(clusterHost); options.setClusterPort(clusterPort); options.setClusterPublicHost(clusterPublicHost); options.setClusterPublicPort(clusterPublicPort); super.beforeStartingVertx(options); } }
.setClusterHost(clusterHost).setClusterPort(clusterPort) .setClusterPublicHost(clusterPublicHost); if (clusterPublicPort != -1) {
assertEquals(options, options.setClusterHost(randString)); assertEquals(randString, options.getClusterHost()); assertEquals(null, options.getClusterPublicHost());
@Before public void setUp() { System.setProperty("vertx-service-discovery-backend-local", "true"); backend = new DefaultServiceDiscoveryBackend(); Vertx.clusteredVertx(new VertxOptions().setClusterHost("127.0.0.1"), ar -> { backend.init(ar.result(), new JsonObject()); vertx = ar.result(); }); await().until(() -> vertx != null); }
@Before public void setUp() { backend = new DefaultServiceDiscoveryBackend(); Vertx.clusteredVertx(new VertxOptions().setClusterHost("127.0.0.1"), ar -> { backend.init(ar.result(), new JsonObject()); vertx = ar.result(); }); await().until(() -> vertx != null); }
options.setWorkerPoolSize(workerPoolSize); options.setBlockedThreadCheckInterval(blockedThreadCheckInterval); options.setClusterHost(clusterHost); options.setClusterPublicHost(clusterPublicHost); options.setClusterPingInterval(clusterPingInterval);
assertEquals(options, options.setClusterHost(randString)); assertEquals(randString, options.getClusterHost()); assertEquals(null, options.getClusterPublicHost());