public static Cluster getCluster ( ZkClient zkClient ) { Cluster cluster = new Cluster ( ) ; List < String > nodes = getChildrenParentMayNotExist ( zkClient , BrokerIdsPath ) ; for ( String node : nodes ) { final String brokerInfoString = readData ( zkClient , BrokerIdsPath + "/" + node ) ; cluster . add ( Broker . createBroker ( Integer . valueOf ( node ) , brokerInfoString ) ) ; } return cluster ; }
read all brokers in the zookeeper