}
return ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
}
private static SortedMap<String,String> getMap(Instance instance, boolean nameAsKey) {
ZooCache zc = getZooCache(instance);
List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
TreeMap<String,String> tableMap = new TreeMap<String,String>();
for (String tableId : tableIds) {
byte[] tblPath = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME);
if (tblPath != null) {
if (nameAsKey)
tableMap.put(new String(tblPath), tableId);
else
tableMap.put(tableId, new String(tblPath));