@Override public Void apply(PathChildrenCacheListener listener) { try { listener.childEvent(client, event); } catch (Exception e) { handleException(e); } return null; } }
@Override public Void apply(PathChildrenCacheListener listener) { try { listener.childEvent(client, event); } catch (Exception e) { handleException(e); } return null; } }
void callListeners(final PathChildrenCacheEvent event) { listeners.forEach ( listener -> { try { listener.childEvent(client, event); } catch (Exception e) { handleException(e); } return null; }); }
@Override public void notify(Path path, PathChildrenCacheEvent event) { try { // Snapshot directoryListeners in case notification leads to new directoryListeners added Set<Map.Entry<Path, PathChildrenCacheListener>> directoryLlistenerSnapshot = new HashSet<>(directoryListeners.entrySet()); for (Map.Entry<Path, PathChildrenCacheListener> listener : directoryLlistenerSnapshot) { if (path.isChildOf(listener.getKey())) listener.getValue().childEvent(curatorFramework, event); } // Snapshot directoryListeners in case notification leads to new directoryListeners added Set<Map.Entry<Path, NodeCacheListener>> fileListenerSnapshot = new HashSet<>(fileListeners.entrySet()); for (Map.Entry<Path, NodeCacheListener> listener : fileListenerSnapshot) { if (path.equals(listener.getKey())) listener.getValue().nodeChanged(); } } catch (Exception e) { e.printStackTrace(); // TODO: Remove throw new RuntimeException("Exception notifying listeners", e); } }
@Override public Void apply(PathChildrenCacheListener listener) { try { listener.childEvent(client, event); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); handleException(e); } return null; } }