@Test public void testMultipleListeners() throws Exception { CountingListener endPointListener1 = new CountingListener(); CountingListener endPointListener2 = new CountingListener(); _discovery.addListener(endPointListener1); _discovery.addListener(endPointListener2); addNode("path", FOO); assertEquals(1, endPointListener1.getNumAdds()); assertEquals(1, endPointListener2.getNumAdds()); removeNode("path", FOO); assertEquals(1, endPointListener1.getNumRemoves()); assertEquals(1, endPointListener2.getNumRemoves()); }
@Override public void addListener(EndPointListener listener) { _listeners.add(listener); _numListeners.inc(); }
ZooKeeperHostDiscovery implements HostDiscovery { @Override public void addListener(EndPointListener listener) { _listeners.add(listener); _numListeners.inc(); } }
ZooKeeperHostDiscovery implements HostDiscovery { @Override public void addListener(EndPointListener listener) { _listeners.add(listener); _numListeners.inc(); } ZooKeeperHostDiscovery(CuratorFramework curator, String serviceName, MetricRegistry metrics); @VisibleForTesting  ZooKeeperHostDiscovery(NodeDiscoveryFactory factory, CuratorFramework curator, String serviceName,
                           MetricRegistry metrics); }
ZooKeeperHostDiscovery implements HostDiscovery { @Override public void addListener(EndPointListener listener) { _listeners.add(listener); _numListeners.inc(); } ZooKeeperHostDiscovery(CuratorFramework curator, String serviceName, MetricRegistry metrics); @VisibleForTesting  ZooKeeperHostDiscovery(NodeDiscoveryFactory factory, CuratorFramework curator, String serviceName,
                           MetricRegistry metrics); @Override Iterable<ServiceEndPoint> getHosts(); @Override void addListener(EndPointListener listener); @Override void removeListener(EndPointListener listener); @Override void close(); static String makeServicePath(String serviceName); }
ZooKeeperHostDiscovery implements HostDiscovery { @Override public void addListener(EndPointListener listener) { _listeners.add(listener); _numListeners.inc(); } ZooKeeperHostDiscovery(CuratorFramework curator, String serviceName, MetricRegistry metrics); @VisibleForTesting  ZooKeeperHostDiscovery(NodeDiscoveryFactory factory, CuratorFramework curator, String serviceName,
                           MetricRegistry metrics); @Override Iterable<ServiceEndPoint> getHosts(); @Override void addListener(EndPointListener listener); @Override void removeListener(EndPointListener listener); @Override void close(); static String makeServicePath(String serviceName);  }