/** * Cannot run with the fake cluster manager. * Subclasses need to override the method and call <code>super.testLockReleasedForClosedNode()</code>. */ @Test @Ignore public void testLockReleasedForClosedNode() throws Exception { testLockReleased(latch -> { vertices[0].close(onSuccess(v -> { latch.countDown(); })); }); }
private void testLockReleased(Consumer<CountDownLatch> action) throws Exception { CountDownLatch lockAquiredLatch = new CountDownLatch(1); vertices[0].sharedData().getLockWithTimeout("pimpo", getLockTimeout(), onSuccess(lock -> { vertices[1].sharedData().getLockWithTimeout("pimpo", getLockTimeout(), onSuccess(lock2 -> { // Eventually acquired after node1 goes down testComplete(); })); lockAquiredLatch.countDown(); })); awaitLatch(lockAquiredLatch); CountDownLatch closeLatch = new CountDownLatch(1); action.accept(closeLatch); awaitLatch(closeLatch); await(); }
/** * 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(); })); }); }
/** * Cannot run with the fake cluster manager. * Subclasses need to override the method and call <code>super.testLockReleasedForClosedNode()</code>. */ @Test @Ignore public void testLockReleasedForClosedNode() throws Exception { testLockReleased(latch -> { vertices[0].close(onSuccess(v -> { latch.countDown(); })); }); }
private void testLockReleased(Consumer<CountDownLatch> action) throws Exception { CountDownLatch lockAquiredLatch = new CountDownLatch(1); vertices[0].sharedData().getLockWithTimeout("pimpo", getLockTimeout(), onSuccess(lock -> { vertices[1].sharedData().getLockWithTimeout("pimpo", getLockTimeout(), onSuccess(lock2 -> { // Eventually acquired after node1 goes down testComplete(); })); lockAquiredLatch.countDown(); })); awaitLatch(lockAquiredLatch); CountDownLatch closeLatch = new CountDownLatch(1); action.accept(closeLatch); awaitLatch(closeLatch); await(); }
/** * 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(); })); }); }