Example usage for com.mongodb ConnectionString getConnectionString

List of usage examples for com.mongodb ConnectionString getConnectionString

Introduction

In this page you can find the example usage for com.mongodb ConnectionString getConnectionString.

Prototype

public String getConnectionString() 

Source Link

Document

Get the unparsed connection string.

Usage

From source file:org.flinkmon.mongo.conn.ShardSetFinder.java

License:Open Source License

private List<MongoClientWrapper> getMongoClient(List<ConnectionString> shardSet) {
    mongoClients = new ArrayList<>();
    try {// w  w w.  j  ava2 s. c  o  m
        for (ConnectionString address : shardSet) {
            com.mongodb.reactivestreams.client.MongoClient client = MongoClients.create(address);
            mongoClients.add(new MongoClientWrapper(address.getConnectionString(), client));
            Thread.sleep(100); // allow the client to establish prior to being
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return mongoClients;
}