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 18
18
19
19
public class ReplicaSets {
20
20
21
- public static void main (String [] args ) throws InterruptedException {
21
+ public static void main (String [] args ) {
22
22
23
23
// Uses the settings builder methods to set read and write settings for the client
24
24
// start-client-settings
@@ -81,7 +81,7 @@ public static void main(String[] args) throws InterruptedException {
81
81
82
82
ReadPreference readPref = ReadPreference .secondary (Arrays .asList (tag1 , tag2 , tag3 ));
83
83
84
- database = mongoClient .getDatabase ("test_database" )
84
+ MongoDatabase database = mongoClient .getDatabase ("test_database" )
85
85
.withReadPreference (readPref );
86
86
// end-tag-set
87
87
@@ -95,7 +95,7 @@ public static void main(String[] args) throws InterruptedException {
95
95
// Instructs the library to distribute reads between members within 35 milliseconds
96
96
// of the closest member's ping time using a URI option
97
97
// start-local-threshold-settings
98
- MongoClient timedClient = MongoClients .create (MongoClientSettings .builder ()
98
+ MongoClient client = MongoClients .create (MongoClientSettings .builder ()
99
99
.applyConnectionString (new ConnectionString ("mongodb://localhost:27017/" ))
100
100
.applyToClusterSettings (builder -> builder .localThreshold (35 , TimeUnit .MILLISECONDS ))
101
101
.build ());
You can’t perform that action at this time.
0 commit comments