use of com.linkedin.d2.discovery.stores.PropertyStore in project rest.li by linkedin.
the class LoadBalancerClientCli method shutdownPropertyStore.
private void shutdownPropertyStore(PropertyStore<?> store, long timeout, TimeUnit unit) throws Exception {
final CountDownLatch registryLatch = new CountDownLatch(1);
store.shutdown(new PropertyEventShutdownCallback() {
@Override
public void done() {
registryLatch.countDown();
}
});
try {
registryLatch.await(timeout, unit);
} catch (InterruptedException e) {
System.err.println("unable to shutdown store: " + store);
}
}
use of com.linkedin.d2.discovery.stores.PropertyStore in project rest.li by linkedin.
the class ZooKeeperEphemeralStoreTest method testShutdown.
@Test(groups = { "small", "back-end" })
public void testShutdown() throws InterruptedException, IOException, PropertyStoreException, ExecutionException {
PropertyStore<String> store = getStore();
final CountDownLatch latch = new CountDownLatch(1);
store.shutdown(new PropertyEventShutdownCallback() {
@Override
public void done() {
latch.countDown();
}
});
if (!latch.await(5, TimeUnit.SECONDS)) {
fail("unable to shut down store");
}
}
use of com.linkedin.d2.discovery.stores.PropertyStore in project rest.li by linkedin.
the class PropertyStoreTest method testShutdown.
@Test(groups = { "small", "back-end" })
public void testShutdown() throws InterruptedException, PropertyStoreException {
PropertyStore<String> store = getStore();
final CountDownLatch latch = new CountDownLatch(1);
store.shutdown(new PropertyEventShutdownCallback() {
@Override
public void done() {
latch.countDown();
}
});
if (!latch.await(5, TimeUnit.SECONDS)) {
fail("unable to shut down store");
}
}
use of com.linkedin.d2.discovery.stores.PropertyStore in project rest.li by linkedin.
the class LoadBalancerClientCli method startStore.
private static <T> void startStore(PropertyStore<T> store) throws PropertyStoreException {
try {
FutureCallback<None> callback = new FutureCallback<>();
store.start(callback);
callback.get(30, TimeUnit.SECONDS);
} catch (Exception e) {
throw new PropertyStoreException("Failed to start store", e);
}
}
Aggregations