@Override public void close() { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { service.shutdownNow(); listeners.clear(); } }
@Override public void close() { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { service.shutdownNow(); listeners.clear(); } }
@Override public void close() throws IOException { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { listeners.clear(); } client.getConnectionStateListenable().removeListener(connectionStateListener); }
@Override public void close() throws IOException { client.getConnectionStateListenable().removeListener(connectionStateListener); state.set(State.CLOSED); listeners.clear(); }
@Override public void close() throws IOException { if ( state.compareAndSet(State.STARTED, State.STOPPED) ) { if ( finalFlushMs > 0 ) { try { flushPuts(finalFlushMs, TimeUnit.MILLISECONDS); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } CloseableUtils.closeQuietly(childrenCache); putListenerContainer.clear(); service.shutdownNow(); } }
@Override public void close() throws IOException { Preconditions.checkState(state.compareAndSet(State.STARTED, State.STOPPED), "Already closed or has not been started"); listenerContainer.forEach( new Function<ServiceCacheListener<T>, Void>() { @Override public Void apply(ServiceCacheListener<T> listener) { discovery.getClient().getConnectionStateListenable().removeListener(listener); return null; } } ); listenerContainer.clear(); CloseableUtils.closeQuietly(cache); discovery.cacheClosed(this); }
@Override public void close() throws IOException { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { listeners.clear(); client.clearWatcherReferences(watcher); client.getConnectionStateListenable().removeListener(connectionStateListener); // TODO // From PathChildrenCache // This seems to enable even more GC - I'm not sure why yet - it // has something to do with Guava's cache and circular references connectionStateListener = null; watcher = null; } }
/** * Close/end the cache * * @throws IOException errors */ @Override public void close() throws IOException { if (state.compareAndSet(State.STARTED, State.CLOSED)) { client.getConnectionStateListenable().removeListener(connectionStateListener); listeners.clear(); client.clearWatcherReferences(childrenWatcher); client.clearWatcherReferences(dataWatcher); } }
/** * Close/end the cache * * @throws IOException errors */ @Override public void close() throws IOException { if (started.compareAndSet(true, false)) { client.getConnectionStateListenable().removeListener(connectionStateListener); executorService.shutdownNow(); try { executorService.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { throw (IOException) new InterruptedIOException().initCause(e); } try { if (isConnected()) { doUpdate(null); callListeners(GroupListener.GroupEvent.DISCONNECTED); } } catch (Exception e) { handleException(e); } listeners.clear(); } }
@Override public void close() throws IOException { Preconditions.checkState(state.compareAndSet(State.STARTED, State.STOPPED), "Already closed or has not been started"); listenerContainer.forEach ( new Function<ServiceCacheListener, Void>() { @Override public Void apply(ServiceCacheListener listener) { discovery.getClient().getConnectionStateListenable().removeListener(listener); return null; } } ); listenerContainer.clear(); CloseableUtils.closeQuietly(cache); discovery.cacheClosed(this); }
handleException(e); listeners.clear(); mapper.getTypeFactory().clearCache(); mapper = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
handleException(e); listeners.clear(); MAPPER.getTypeFactory().clearCache(); MAPPER = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
/** * Close/end the cache. */ @Override public void close() { if ( treeState.compareAndSet(TreeState.STARTED, TreeState.CLOSED) ) { client.getConnectionStateListenable().removeListener(connectionStateListener); listeners.clear(); executorService.shutdown(); try { root.wasDeleted(); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); handleException(e); } } }
/** * Close/end the cache * * @throws IOException errors */ @Override public void close() throws IOException { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { client.getConnectionStateListenable().removeListener(connectionStateListener); listeners.clear(); executorService.close(); client.clearWatcherReferences(childrenWatcher); client.clearWatcherReferences(dataWatcher); // TODO // This seems to enable even more GC - I'm not sure why yet - it // has something to do with Guava's cache and circular references connectionStateListener = null; childrenWatcher = null; dataWatcher = null; } }
/** * 发起监控 * * @param clientId * @param listener */ public static void startWatch(String clientId, NodeCacheListener listener) { String node = PathHelper.createPublishPath(clientId, getConfigPath()); if (nodeCache == null) { nodeCache = new NodeCache(curator, node); } nodeCache.getListenable().clear(); nodeCache.getListenable().addListener(listener); if (watchFlag == false) { try { nodeCache.start(); watchFlag = true; } catch (Exception e) { throw new BaseRuntimeException("0TE120119016", e, node); } }else{ LOGGER.warnMessage("远程配置,请不要重复发起针对节点[{}]的监听", node); } }