protected void closeClustered(List<Vertx> clustered) throws Exception { CountDownLatch latch = new CountDownLatch(clustered.size()); for (Vertx clusteredVertx : clustered) { clusteredVertx.close(ar -> { if (ar.failed()) { log.error("Failed to shutdown vert.x", ar.cause()); } latch.countDown(); }); } assertTrue(latch.await(180, TimeUnit.SECONDS)); }
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()); } }
public void setUp() throws Exception { super.setUp(); vinit(); VertxOptions options = getOptions(); boolean nativeTransport = options.getPreferNativeTransport(); vertx = Vertx.vertx(options); if (nativeTransport) { assertTrue(vertx.isNativeTransportEnabled()); } }
protected void closeClustered(List<Vertx> clustered) throws Exception { CountDownLatch latch = new CountDownLatch(clustered.size()); for (Vertx clusteredVertx : clustered) { clusteredVertx.close(ar -> { if (ar.failed()) { log.error("Failed to shutdown vert.x", ar.cause()); } latch.countDown(); }); } assertTrue(latch.await(180, TimeUnit.SECONDS)); }
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()); } }
public void setUp() throws Exception { super.setUp(); vinit(); VertxOptions options = getOptions(); boolean nativeTransport = options.getPreferNativeTransport(); vertx = Vertx.vertx(options); if (nativeTransport) { assertTrue(vertx.isNativeTransportEnabled()); } }