private Pair < BasicDBList , List < ServerAddress > > getSplitDataCollectionShardEnviroment ( Map < String , String [ ] > shards , String dbName , String collectionName ) { MongoClient mongoClient = null ; try { Set < String > keys = shards . keySet ( ) ; for ( String key : keys ) { List < ServerAddress > addressList = getServerAddressList ( Arrays . asList ( shards . get ( key ) ) ) ; mongoClient = new MongoClient ( addressList ) ; BasicDBList dbList = getSplitData ( mongoClient . getDB ( dbName ) . getCollection ( collectionName ) ) ; if ( dbList != null ) { return Pair . create ( dbList , addressList ) ; } } } catch ( UnknownHostException e ) { throw new DeepGenericException ( e ) ; } finally { if ( mongoClient != null ) { mongoClient . close ( ) ; } } return null ; }
Gets split data collection shard enviroment .