protected void afterNodesKilled() throws Exception { ClusterManager clusterManager = vertx.getClusterManager(); assertEqualsEventually("Remaining members", Integer.valueOf(2), () -> clusterManager.getNodes().size()); }
@Test public void testSubsRemovedForKilledNode() throws Exception { testSubsRemoved(latch -> { VertxInternal vi = (VertxInternal)vertices[1]; vi.getClusterManager().leave(onSuccess(v -> { latch.countDown(); })); }); }
@Override public void setUp() throws Exception { super.setUp(); startNodes(1); clusterManager = ((VertxInternal) vertices[0]).getClusterManager(); CountDownLatch latch = new CountDownLatch(1); clusterManager.<String, ServerID>getAsyncMultiMap("mymap", onSuccess(res -> { map = res; latch.countDown(); })); awaitLatch(latch); }
/** * Cannot run with the fake cluster manager. * Subclasses need to override the method and call <code>super.testLockReleasedForKilledNode()</code>. */ @Test @Ignore public void testLockReleasedForKilledNode() throws Exception { testLockReleased(latch -> { VertxInternal vi = (VertxInternal) vertices[0]; vi.getClusterManager().leave(onSuccess(v -> { latch.countDown(); })); }); }
protected void afterNodesKilled() throws Exception { ClusterManager clusterManager = vertx.getClusterManager(); assertEqualsEventually("Remaining members", Integer.valueOf(2), () -> clusterManager.getNodes().size()); }
@Override public void setUp() throws Exception { super.setUp(); startNodes(1); clusterManager = ((VertxInternal) vertices[0]).getClusterManager(); CountDownLatch latch = new CountDownLatch(1); clusterManager.<String, ServerID>getAsyncMultiMap("mymap", onSuccess(res -> { map = res; latch.countDown(); })); awaitLatch(latch); }
@Test public void testSubsRemovedForKilledNode() throws Exception { testSubsRemoved(latch -> { VertxInternal vi = (VertxInternal)vertices[1]; vi.getClusterManager().leave(onSuccess(v -> { latch.countDown(); })); }); }
/** * Cannot run with the fake cluster manager. * Subclasses need to override the method and call <code>super.testLockReleasedForKilledNode()</code>. */ @Test @Ignore public void testLockReleasedForKilledNode() throws Exception { testLockReleased(latch -> { VertxInternal vi = (VertxInternal) vertices[0]; vi.getClusterManager().leave(onSuccess(v -> { latch.countDown(); })); }); }
public static void closeClustered(List<Vertx> clustered) throws Exception { for (Vertx vertx : clustered) { VertxInternal vertxInternal = (VertxInternal) vertx; HazelcastClusterManager clusterManager = (HazelcastClusterManager) vertxInternal.getClusterManager(); HazelcastInstance hazelcastInstance = clusterManager.getHazelcastInstance(); SECONDS.sleep(2); // Make sure rebalancing has been triggered long start = System.currentTimeMillis(); try { while (!hazelcastInstance.getPartitionService().isClusterSafe() && System.currentTimeMillis() - start < MILLISECONDS.convert(2, MINUTES)) { MILLISECONDS.sleep(100); } } catch (Exception ignore) { } CountDownLatch latch = new CountDownLatch(1); vertxInternal.close(ar -> { if (ar.failed()) { log.error("Failed to shutdown vert.x", ar.cause()); } latch.countDown(); }); latch.await(2, TimeUnit.MINUTES); } }
public static void closeClustered(List<Vertx> clustered) throws Exception { for (Vertx vertx : clustered) { VertxInternal vertxInternal = (VertxInternal) vertx; InfinispanClusterManager clusterManager = (InfinispanClusterManager) vertxInternal.getClusterManager(); EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) clusterManager.getCacheContainer(); Health health = cacheManager.getHealth(); SECONDS.sleep(2); // Make sure rebalancing has been triggered long start = System.currentTimeMillis(); try { while (health.getClusterHealth().getHealthStatus() != HealthStatus.HEALTHY && System.currentTimeMillis() - start < MILLISECONDS.convert(2, MINUTES)) { MILLISECONDS.sleep(100); } } catch (Exception ignore) { } CountDownLatch latch = new CountDownLatch(1); vertxInternal.close(ar -> { if (ar.failed()) { log.error("Failed to shutdown vert.x", ar.cause()); } latch.countDown(); }); latch.await(2, TimeUnit.MINUTES); } }
@Before public void setUp() { Vertx.clusteredVertx(new VertxOptions(), ar -> { ((VertxInternal) ar.result()).getClusterManager().<String, String>getAsyncMap("some-name", x -> { map = x.result(); vertx = ar.result(); }); }); await().until(() -> vertx != null); } }
@Before public void setUp() { Vertx.clusteredVertx(new VertxOptions(), ar -> { ((VertxInternal) ar.result()).getClusterManager().<String, String>getAsyncMap("some-name", x -> { map = x.result(); vertx = ar.result(); }); }); await().until(() -> vertx != null); } }
CircuitBreakerMetrics(Vertx vertx, CircuitBreakerImpl circuitBreaker, CircuitBreakerOptions options) { this.circuitBreaker = circuitBreaker; this.circuitBreakerTimeout = circuitBreaker.options().getTimeout(); this.circuitBreakerResetTimeout = circuitBreaker.options().getResetTimeout(); this.node = vertx.isClustered() ? ((VertxInternal) vertx).getClusterManager().getNodeID() : "local"; this.rollingWindow = new RollingWindow(options.getMetricsRollingWindow(), options.getMetricsRollingBuckets()); }