@Test public void testSameWatcherDifferentKinds() throws Exception { CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); try { client.start(); WatcherRemovalFacade removerClient = (WatcherRemovalFacade)client.newWatcherRemoveCuratorFramework(); Watcher watcher = new Watcher() { @Override public void process(WatchedEvent event) { } }; removerClient.create().creatingParentsIfNeeded().forPath("/a/b/c"); removerClient.checkExists().usingWatcher(watcher).forPath("/a/b/c"); removerClient.getData().usingWatcher(watcher).forPath("/a/b/c"); removerClient.removeWatchers(); } finally { TestCleanState.closeAndTestClean(client); } }
void removeWatchers() { if ( client.isZk34CompatibilityMode() ) { return; } List<NamespaceWatcher> localEntries = Lists.newArrayList(entries); while ( localEntries.size() > 0 ) { NamespaceWatcher watcher = localEntries.remove(0); if ( entries.remove(watcher) && !client.isZk34CompatibilityMode() ) { try { log.debug("Removing watcher for path: " + watcher.getUnfixedPath()); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.internalRemoval(watcher, watcher.getUnfixedPath()); } catch ( Exception e ) { log.error("Could not remove watcher for path: " + watcher.getUnfixedPath()); } } } }
WatcherRemovalManager { void removeWatchers() { if ( client.isZk34CompatibilityMode() ) { return; } List<NamespaceWatcher> localEntries = Lists.newArrayList(entries); while ( localEntries.size() > 0 ) { NamespaceWatcher watcher = localEntries.remove(0); if ( entries.remove(watcher) && !client.isZk34CompatibilityMode() ) { try { log.debug("Removing watcher for path: " + watcher.getUnfixedPath()); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.internalRemoval(watcher, watcher.getUnfixedPath()); } catch ( Exception e ) { log.error("Could not remove watcher for path: " + watcher.getUnfixedPath()); } } } } }
WatcherRemovalManager { void removeWatchers() { if ( client.isZk34CompatibilityMode() ) { return; } List<NamespaceWatcher> localEntries = Lists.newArrayList(entries); while ( localEntries.size() > 0 ) { NamespaceWatcher watcher = localEntries.remove(0); if ( entries.remove(watcher) && !client.isZk34CompatibilityMode() ) { try { log.debug("Removing watcher for path: " + watcher.getUnfixedPath()); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.internalRemoval(watcher, watcher.getUnfixedPath()); } catch ( Exception e ) { log.error("Could not remove watcher for path: " + watcher.getUnfixedPath()); } } } } WatcherRemovalManager(CuratorFrameworkImpl client); }
WatcherRemovalManager { void removeWatchers() { if ( client.isZk34CompatibilityMode() ) { return; } List<NamespaceWatcher> localEntries = Lists.newArrayList(entries); while ( localEntries.size() > 0 ) { NamespaceWatcher watcher = localEntries.remove(0); if ( entries.remove(watcher) && !client.isZk34CompatibilityMode() ) { try { log.debug("Removing watcher for path: " + watcher.getUnfixedPath()); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.internalRemoval(watcher, watcher.getUnfixedPath()); } catch ( Exception e ) { log.error("Could not remove watcher for path: " + watcher.getUnfixedPath()); } } } } WatcherRemovalManager(CuratorFrameworkImpl client);  }
WatcherRemovalManager { void removeWatchers() { if ( client.isZk34CompatibilityMode() ) { return; } List<NamespaceWatcher> localEntries = Lists.newArrayList(entries); while ( localEntries.size() > 0 ) { NamespaceWatcher watcher = localEntries.remove(0); if ( entries.remove(watcher) && !client.isZk34CompatibilityMode() ) { try { log.debug("Removing watcher for path: " + watcher.getUnfixedPath()); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.internalRemoval(watcher, watcher.getUnfixedPath()); } catch ( Exception e ) { log.error("Could not remove watcher for path: " + watcher.getUnfixedPath()); } } } } WatcherRemovalManager(CuratorFrameworkImpl client);   }