File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
source/includes/fundamentals/code-snippets Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1818
1919public class ReplicaSets {
2020
21- public static void main (String [] args ) throws InterruptedException {
21+ public static void main (String [] args ) {
2222
2323 // Uses the settings builder methods to set read and write settings for the client
2424 // start-client-settings
@@ -81,7 +81,7 @@ public static void main(String[] args) throws InterruptedException {
8181
8282 ReadPreference readPref = ReadPreference .secondary (Arrays .asList (tag1 , tag2 , tag3 ));
8383
84- database = mongoClient .getDatabase ("test_database" )
84+ MongoDatabase database = mongoClient .getDatabase ("test_database" )
8585 .withReadPreference (readPref );
8686 // end-tag-set
8787
@@ -95,7 +95,7 @@ public static void main(String[] args) throws InterruptedException {
9595 // Instructs the library to distribute reads between members within 35 milliseconds
9696 // of the closest member's ping time using a URI option
9797 // start-local-threshold-settings
98- MongoClient timedClient = MongoClients .create (MongoClientSettings .builder ()
98+ MongoClient client = MongoClients .create (MongoClientSettings .builder ()
9999 .applyConnectionString (new ConnectionString ("mongodb://localhost:27017/" ))
100100 .applyToClusterSettings (builder -> builder .localThreshold (35 , TimeUnit .MILLISECONDS ))
101101 .build ());
You can’t perform that action at this time.
0 commit comments