@Test public void testGetZooCache() { String zks1 = "zk1"; int timeout1 = 1000; ZooCache zc1 = zcf.getZooCache(zks1, timeout1); ZooCache zc1a = zcf.getZooCache(zks1, timeout1); assertSame(zc1, zc1a); String zks2 = "zk2"; int timeout2 = 1000; ZooCache zc2 = zcf.getZooCache(zks2, timeout2); assertNotSame(zc1, zc2); String zks3 = "zk1"; int timeout3 = 2000; ZooCache zc3 = zcf.getZooCache(zks3, timeout3); assertNotSame(zc1, zc3); }
public ZooCache getZooCache(String zooKeepers, int sessionTimeout) { String key = zooKeepers + ":" + sessionTimeout; synchronized (instances) { if (!isEnabled()) { throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is " + "disabled. This is likely caused by all AccumuloClients being closed"); } ZooCache zc = instances.get(key); if (zc == null) { zc = new ZooCache(zooKeepers, sessionTimeout); instances.put(key, zc); } return zc; } }
ZooCacheFactory { public ZooCache getZooCache(String zooKeepers, int sessionTimeout) { String key = zooKeepers + ":" + sessionTimeout; synchronized (instances) { if (!isEnabled()) { throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is " + "disabled. This is likely caused by all AccumuloClients being closed"); } ZooCache zc = instances.get(key); if (zc == null) { zc = new ZooCache(zooKeepers, sessionTimeout); instances.put(key, zc); } return zc; } } }
ZooCacheFactory { public ZooCache getZooCache(String zooKeepers, int sessionTimeout) { String key = zooKeepers + ":" + sessionTimeout; synchronized (instances) { if (!isEnabled()) { throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is " + "disabled. This is likely caused by all AccumuloClients being closed"); } ZooCache zc = instances.get(key); if (zc == null) { zc = new ZooCache(zooKeepers, sessionTimeout); instances.put(key, zc); } return zc; } }  }
ZooCacheFactory { public ZooCache getZooCache(String zooKeepers, int sessionTimeout) { String key = zooKeepers + ":" + sessionTimeout; synchronized (instances) { if (!isEnabled()) { throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is " + "disabled. This is likely caused by all AccumuloClients being closed"); } ZooCache zc = instances.get(key); if (zc == null) { zc = new ZooCache(zooKeepers, sessionTimeout); instances.put(key, zc); } return zc; } }  ZooCache getZooCache(String zooKeepers, int sessionTimeout); ZooCache getZooCache(String zooKeepers, int sessionTimeout, Watcher watcher); }
ZooCacheFactory { public ZooCache getZooCache(String zooKeepers, int sessionTimeout) { String key = zooKeepers + ":" + sessionTimeout; synchronized (instances) { if (!isEnabled()) { throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is " + "disabled. This is likely caused by all AccumuloClients being closed"); } ZooCache zc = instances.get(key); if (zc == null) { zc = new ZooCache(zooKeepers, sessionTimeout); instances.put(key, zc); } return zc; } }  ZooCache getZooCache(String zooKeepers, int sessionTimeout); ZooCache getZooCache(String zooKeepers, int sessionTimeout, Watcher watcher);  }