@@ -124,41 +124,39 @@ boolean hasServerUp() {
124
124
// Simple abstraction over a volatile ReplicaSet reference that starts as null. The get method blocks until members
125
125
// is not null. The set method notifies all, thus waking up all getters.
126
126
@ ThreadSafe
127
- static class ReplicaSetHolder {
128
- private volatile ReplicaSet members ;
129
-
130
- // blocks until replica set is set, or a timeout occurs
131
- synchronized ReplicaSet get () {
132
- while (members == null ) {
133
- try {
134
- wait (ReplicaSetStatus .mongoOptionsDefaults .socketTimeout );
135
- }
136
- catch (InterruptedException e ) {
137
- throw new MongoInterruptedException ("Interrupted while waiting for next update to replica set status" , e );
138
- }
139
- }
140
- return members ;
141
- }
142
-
143
- // set the replica set to a non-null value and notifies all threads waiting.
144
- synchronized void set (ReplicaSet members ) {
145
- if (members == null ) {
146
- throw new IllegalArgumentException ("members can not be null" );
147
- }
148
-
149
- this .members = members ;
150
- notifyAll ();
151
- }
152
-
153
- // blocks until the replica set is set again
154
- synchronized void waitForNextUpdate () {
155
- try {
156
- wait (ReplicaSetStatus .mongoOptionsDefaults .socketTimeout );
157
- }
158
- catch (InterruptedException e ) {
159
- throw new MongoInterruptedException ("Interrupted while waiting for next update to replica set status" , e );
160
- }
161
- }
127
+ class ReplicaSetHolder {
128
+ private volatile ReplicaSet members ;
129
+
130
+ // blocks until replica set is set, or a timeout occurs
131
+ synchronized ReplicaSet get () {
132
+ while (members == null ) {
133
+ try {
134
+ wait (_mongo .getMongoOptions ().getConnectTimeout ());
135
+ } catch (InterruptedException e ) {
136
+ throw new MongoInterruptedException ("Interrupted while waiting for next update to replica set status" , e );
137
+ }
138
+ }
139
+ return members ;
140
+ }
141
+
142
+ // set the replica set to a non-null value and notifies all threads waiting.
143
+ synchronized void set (ReplicaSet members ) {
144
+ if (members == null ) {
145
+ throw new IllegalArgumentException ("members can not be null" );
146
+ }
147
+
148
+ this .members = members ;
149
+ notifyAll ();
150
+ }
151
+
152
+ // blocks until the replica set is set again
153
+ synchronized void waitForNextUpdate () {
154
+ try {
155
+ wait (_mongo .getMongoOptions ().getConnectTimeout ());
156
+ } catch (InterruptedException e ) {
157
+ throw new MongoInterruptedException ("Interrupted while waiting for next update to replica set status" , e );
158
+ }
159
+ }
162
160
163
161
public synchronized void close () {
164
162
this .members = null ;
0 commit comments