/** * Unregister/remove a service instance * * @param service the service * @throws Exception errors */ @Override public void unregisterService(ServiceInstance<T> service) throws Exception { Entry<T> entry = services.remove(service.getId()); internalUnregisterService(entry); }
/** * Unregister/remove a group instance * * @param service the group * @throws Exception errors */ @Override public void unregisterService(ServiceInstance<T> service) throws Exception { Entry<T> entry = services.remove(service.getId()); internalUnregisterService(entry); }
@Override public void close() throws IOException { for ( ServiceCache<T> cache : Lists.newArrayList(caches) ) { CloseableUtils.closeQuietly(cache); } for ( ServiceProvider<T> provider : Lists.newArrayList(providers) ) { CloseableUtils.closeQuietly(provider); } for ( Entry<T> entry : services.values() ) { try { internalUnregisterService(entry); } catch ( KeeperException.NoNodeException ignore ) { // ignore } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); log.error("Could not unregister instance: " + entry.service.getName(), e); } } client.getConnectionStateListenable().removeListener(connectionStateListener); }
@Override public void close() throws IOException { ExceptionAccumulator accumulator = new ExceptionAccumulator(); for ( ServiceProvider<T> provider : Lists.newArrayList(providers) ) { CloseableUtils.closeQuietly(provider); } for ( Entry<T> entry : services.values() ) { try { internalUnregisterService(entry); } catch ( KeeperException.NoNodeException ignore ) { // ignore } catch ( Exception e ) { accumulator.add(e); log.error("Could not unregister instance: " + entry.service.getName(), e); } } client.getConnectionStateListenable().removeListener(connectionStateListener); accumulator.propagate(); }