@Override public void queueShutdown() { healthServiceAsync.unregister(serviceName); }
@Test public void testRegister() throws Exception { final AtomicBoolean result = new AtomicBoolean(); healthService.register("foo", 1, TimeUnit.SECONDS); final CountDownLatch countDownLatch = new CountDownLatch(1); healthService.findAllNodes(names -> { result.set(names.stream().anyMatch(s -> s.equals("foo"))); countDownLatch.countDown(); } ); countDownLatch.await(10, TimeUnit.SECONDS); assertTrue("foo is found", result.get()); healthService.unregister("foo"); final CountDownLatch countDownLatch2 = new CountDownLatch(1); result.set(false); healthService.findAllNodes(names -> { result.set(!names.stream().anyMatch(s -> s.equals("foo"))); countDownLatch2.countDown(); } ); countDownLatch2.await(10, TimeUnit.SECONDS); }
@Override public void queueShutdown() { healthServiceAsync.unregister(serviceName); }
@Override public void queueShutdown() { healthServiceAsync.unregister(serviceName); }