List of usage examples for com.mongodb.connection ClusterSettings builder
public static Builder builder()
From source file:org.openo.commontosca.inventory.core.mongo.MongoInventoryProvider.java
License:Apache License
public static MongoClient create(final String url) { ConnectionString connectionString = new ConnectionString(url); Builder builder = MongoClientSettings.builder(); builder.clusterSettings(ClusterSettings.builder().applyConnectionString(connectionString).build()); builder.connectionPoolSettings(//from w w w. jav a 2 s .c o m ConnectionPoolSettings.builder().applyConnectionString(connectionString).build()); builder.serverSettings(ServerSettings.builder().build()); builder.credentialList(connectionString.getCredentialList()); builder.sslSettings(SslSettings.builder().applyConnectionString(connectionString).build()); builder.socketSettings(SocketSettings.builder().applyConnectionString(connectionString).build()); builder.codecRegistry( CodecRegistries.fromRegistries(MongoClients.getDefaultCodecRegistry(), new ObjectCodecRegistry())); // builder.streamFactoryFactory(new NettyStreamFactoryFactory()); return MongoClients.create(builder.build()); }