protected void closeVertices(Vertx... vertices) throws Exception { CountDownLatch latch = new CountDownLatch(vertices.length); for (int i = 0; i < vertices.length; i++) { if (vertices[i] != null) { vertices[i].close(onSuccess(res -> { latch.countDown(); })); } else { latch.countDown(); } } latch.await(2, TimeUnit.MINUTES); }
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(); }
protected void closeVertices(Vertx... vertices) throws Exception { CountDownLatch latch = new CountDownLatch(vertices.length); for (int i = 0; i < vertices.length; i++) { if (vertices[i] != null) { vertices[i].close(onSuccess(res -> { latch.countDown(); })); } else { latch.countDown(); } } latch.await(2, TimeUnit.MINUTES); }
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(); }