CurrentMeta implements Releasable { @Override public void release() throws Exception { for (CurrentClusterMeta currentClusterMeta : currentMetas.values()) { try { currentClusterMeta.release(); } catch (Exception e) { logger.error("[release]" + currentClusterMeta.getClusterId(), e); } } }  Set<String> allClusters(); boolean hasCluster(String clusterId); boolean hasShard(String clusterId, String shardId); boolean watchIfNotWatched(String clusterId, String shardId); void setSurviveKeepers(String clusterId, String shardId, List<KeeperMeta> surviveKeepers,
			KeeperMeta activeKeeper); void addResource(String clusterId, String shardId, Releasable releasable); List<KeeperMeta> getSurviveKeepers(String clusterId, String shardId); boolean setKeeperActive(String clusterId, String shardId, KeeperMeta keeperMeta); KeeperMeta getKeeperActive(String clusterId, String shardId); boolean setKeeperMaster(String clusterId, String shardId, Pair<String, Integer> keeperMaster); Pair<String, Integer> getKeeperMaster(String clusterId, String shardId); void setCurrentCRDTMaster(String clusterId, String shardId,  RedisMeta peerMaster); RedisMeta getCurrentCRDTMaster(String clusterId, String shardId); RedisMeta getCurrentMaster(String clusterId, String shardId); void setPeerMaster(String dcId, String clusterId, String shardId, RedisMeta peerMaster); RedisMeta getPeerMaster(String dcId, String clusterId, String shardId); void removePeerMaster(String dcId, String clusterId, String shardId); Set<String> getUpstreamPeerDcs(String clusterId, String shardId); List<RedisMeta> getAllPeerMasters(String clusterId, String shardId); @Override void release(); void addCluster(final ClusterMeta clusterMeta); CurrentClusterMeta removeCluster(String clusterId); void changeCluster(ClusterMetaComparator comparator); @Override String toString(); static CurrentMeta fromJson(String json);  }
@Test public void testRelease(){ currentMeta.addResource(clusterId, shardId, new Releasable() { @Override public void release() throws Exception { releaseCount.incrementAndGet(); } }); currentMeta.removeCluster(clusterId); Assert.assertEquals(1, releaseCount.get()); }