public void stopListener() { try { if (start.compareAndSet(true, false)) { childrenCache.getListenable().removeListener(childrenCacheListener); childrenCache.clear(); childrenCache.close(); } } catch (IOException e) { throw new ZkException(e); } } }
public void stopListener() { try { if (start.compareAndSet(true, false)) { childrenCache.getListenable().removeListener(childrenCacheListener); childrenCache.clear(); childrenCache.close(); } } catch (IOException e) { throw new ZkException(e); } } }
@Override public void unregisterBucketListener(int bucket) { PathChildrenCache cache = bucketCacheMap.remove(bucket); if (cache != null) { try { cache.clear(); cache.close(); } catch (IOException e) { log.warn("unable to close watch on bucket {} with exception {}", bucket, e); } } }
@Override public void unregisterBucketOwnershipListener() { if (bucketOwnershipCacheRef.get() != null) { try { bucketOwnershipCacheRef.get().clear(); bucketOwnershipCacheRef.get().close(); } catch (IOException e) { log.warn("unable to close listener for bucket ownership {}", e); } } }
public void stopListener() { try { if (start.compareAndSet(true, false)) { childrenCache.getListenable().removeListener(childrenCacheListener); childrenCache.clear(); childrenCache.close(); } } catch (IOException e) { throw new ZkException(e); } } }
/** * NOTE: this is a BLOCKING method. Completely rebuild the internal cache by querying * for all needed data WITHOUT generating any events to send to listeners. * * @throws Exception errors */ public void rebuild() throws Exception { Preconditions.checkState(!executorService.isShutdown(), "cache has been closed"); ensurePath(); clear(); List<String> children = client.getChildren().forPath(path); for ( String child : children ) { String fullPath = ZKPaths.makePath(path, child); internalRebuildNode(fullPath); if ( rebuildTestExchanger != null ) { rebuildTestExchanger.exchange(new Object()); } } // this is necessary so that any updates that occurred while rebuilding are taken offerOperation(new RefreshOperation(this, RefreshMode.FORCE_GET_DATA_AND_STAT)); }