/** * Gets a {@link ZooCache}. The same object may be returned for multiple calls with the same * arguments. * * @param zooKeepers * comma-separated list of ZooKeeper host[:port]s * @param sessionTimeout * session timeout * @return cache object */ 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; } }