public static ClusterState load(Integer version,byte[] bytes,Set<String> liveNodes,String znode){
  if (bytes == null || bytes.length == 0) {
    return new ClusterState(version,liveNodes,Collections.<String,DocCollection>emptyMap());
  }
  Map<String,Object> stateMap=(Map<String,Object>)Utils.fromJSON(bytes);
  Map<String,CollectionRef> collections=new LinkedHashMap<>(stateMap.size());
  for (  Entry<String,Object> entry : stateMap.entrySet()) {
    String collectionName=entry.getKey();
    DocCollection coll=collectionFromObjects(collectionName,(Map<String,Object>)entry.getValue(),version,znode);
    collections.put(collectionName,new CollectionRef(coll));
  }
  return new ClusterState(liveNodes,collections,version);
}

public static ClusterState load ( Integer version , byte [ ] bytes , Set < String > liveNodes , String znode ) { if ( bytes == null || bytes . length == 0 ) { return new ClusterState ( version , liveNodes , Collections . < String , DocCollection > emptyMap ( ) ) ; } Map < String , Object > stateMap = ( Map < String , Object > ) Utils . fromJSON ( bytes ) ; Map < String , CollectionRef > collections = new LinkedHashMap < > ( stateMap . size ( ) ) ; for ( Entry < String , Object > entry : stateMap . entrySet ( ) ) { String collectionName = entry . getKey ( ) ; DocCollection coll = collectionFromObjects ( collectionName , ( Map < String , Object > ) entry . getValue ( ) , version , znode ) ; collections . put ( collectionName , new CollectionRef ( coll ) ) ; } return new ClusterState ( liveNodes , collections , version ) ; }
create clusterstate from json string that is typically stored in zookeeper .
