Skip to content

Commit 53bf5b5

Browse files
committed
Move StableMultiServerCluster to MultiServerCluster
Did this in two steps so that we wouldn't lose the history on the former MultiServerCluster class (which is now called AbstractMultiServerCluster) JAVA-2927
1 parent 3b215b5 commit 53bf5b5

File tree

7 files changed

+54
-54
lines changed

7 files changed

+54
-54
lines changed

driver-core/src/main/com/mongodb/connection/DefaultClusterFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.mongodb.internal.connection.DefaultDnsSrvRecordMonitorFactory;
2828
import com.mongodb.internal.connection.DnsMultiServerCluster;
2929
import com.mongodb.internal.connection.DnsSrvRecordMonitorFactory;
30-
import com.mongodb.internal.connection.StableMultiServerCluster;
30+
import com.mongodb.internal.connection.MultiServerCluster;
3131
import com.mongodb.internal.connection.SingleServerCluster;
3232

3333
import java.util.Collections;
@@ -192,7 +192,7 @@ public Cluster createCluster(final ClusterSettings clusterSettings, final Server
192192
return new SingleServerCluster(clusterId, clusterSettings, serverFactory);
193193
} else if (clusterSettings.getMode() == ClusterConnectionMode.MULTIPLE) {
194194
if (clusterSettings.getSrvHost() == null) {
195-
return new StableMultiServerCluster(clusterId, clusterSettings, serverFactory);
195+
return new MultiServerCluster(clusterId, clusterSettings, serverFactory);
196196
} else {
197197
return new DnsMultiServerCluster(clusterId, clusterSettings, serverFactory, dnsSrvRecordMonitorFactory);
198198
}

driver-core/src/main/com/mongodb/internal/connection/StableMultiServerCluster.java renamed to driver-core/src/main/com/mongodb/internal/connection/MultiServerCluster.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
import static com.mongodb.assertions.Assertions.isTrue;
2323

24-
public final class StableMultiServerCluster extends AbstractMultiServerCluster {
25-
public StableMultiServerCluster(final ClusterId clusterId, final ClusterSettings settings,
26-
final ClusterableServerFactory serverFactory) {
24+
public final class MultiServerCluster extends AbstractMultiServerCluster {
25+
public MultiServerCluster(final ClusterId clusterId, final ClusterSettings settings,
26+
final ClusterableServerFactory serverFactory) {
2727
super(clusterId, settings, serverFactory);
2828
isTrue("srvHost is null", settings.getSrvHost() == null);
2929
initialize(settings.getHosts());

driver-core/src/test/unit/com/mongodb/internal/connection/AbstractServerDiscoveryAndMonitoringTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected void init(final ServerListenerFactory serverListenerFactory, final Clu
147147
if (settings.getMode() == ClusterConnectionMode.SINGLE) {
148148
cluster = new SingleServerCluster(clusterId, clusterSettings, factory);
149149
} else {
150-
cluster = new StableMultiServerCluster(clusterId, clusterSettings, factory);
150+
cluster = new MultiServerCluster(clusterId, clusterSettings, factory);
151151
}
152152
}
153153

driver-core/src/test/unit/com/mongodb/internal/connection/BaseClusterSpecification.groovy

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ class BaseClusterSpecification extends Specification {
6161
.serverSelectionTimeout(1, SECONDS)
6262
.serverSelector(new ServerAddressSelector(firstServer))
6363
.build()
64-
def cluster = new StableMultiServerCluster(new ClusterId(), clusterSettings, factory)
64+
def cluster = new MultiServerCluster(new ClusterId(), clusterSettings, factory)
6565

6666
expect:
6767
cluster.getSettings() == clusterSettings
6868
}
6969

7070
def 'should compose server selector passed to selectServer with server selector in cluster settings'() {
7171
given:
72-
def cluster = new StableMultiServerCluster(new ClusterId(),
72+
def cluster = new MultiServerCluster(new ClusterId(),
7373
builder().mode(MULTIPLE)
7474
.hosts([firstServer, secondServer, thirdServer])
7575
.serverSelectionTimeout(1, SECONDS)
@@ -86,7 +86,7 @@ class BaseClusterSpecification extends Specification {
8686

8787
def 'should use server selector passed to selectServer if server selector in cluster settings is null'() {
8888
given:
89-
def cluster = new StableMultiServerCluster(new ClusterId(),
89+
def cluster = new MultiServerCluster(new ClusterId(),
9090
builder().mode(MULTIPLE)
9191
.serverSelectionTimeout(1, SECONDS)
9292
.hosts([firstServer, secondServer, thirdServer])
@@ -102,7 +102,7 @@ class BaseClusterSpecification extends Specification {
102102

103103
def 'should timeout with useful message'() {
104104
given:
105-
def cluster = new StableMultiServerCluster(new ClusterId(),
105+
def cluster = new MultiServerCluster(new ClusterId(),
106106
builder().mode(MULTIPLE)
107107
.hosts([firstServer, secondServer])
108108
.serverSelectionTimeout(serverSelectionTimeoutMS, MILLISECONDS)
@@ -143,7 +143,7 @@ class BaseClusterSpecification extends Specification {
143143

144144
def 'should select server'() {
145145
given:
146-
def cluster = new StableMultiServerCluster(new ClusterId(),
146+
def cluster = new MultiServerCluster(new ClusterId(),
147147
builder().mode(MULTIPLE)
148148
.hosts([firstServer, secondServer, thirdServer])
149149
.serverSelectionTimeout(serverSelectionTimeoutMS, SECONDS)
@@ -166,7 +166,7 @@ class BaseClusterSpecification extends Specification {
166166
@Category(Slow)
167167
def 'should wait indefinitely for a server until interrupted'() {
168168
given:
169-
def cluster = new StableMultiServerCluster(new ClusterId(),
169+
def cluster = new MultiServerCluster(new ClusterId(),
170170
builder().mode(MULTIPLE)
171171
.hosts([firstServer, secondServer, thirdServer])
172172
.serverSelectionTimeout(-1, SECONDS)
@@ -197,7 +197,7 @@ class BaseClusterSpecification extends Specification {
197197
@Category(Slow)
198198
def 'should wait indefinitely for a cluster description until interrupted'() {
199199
given:
200-
def cluster = new StableMultiServerCluster(new ClusterId(),
200+
def cluster = new MultiServerCluster(new ClusterId(),
201201
builder().mode(MULTIPLE)
202202
.hosts([firstServer, secondServer, thirdServer])
203203
.serverSelectionTimeout(-1, SECONDS)
@@ -227,7 +227,7 @@ class BaseClusterSpecification extends Specification {
227227

228228
def 'should select server asynchronously when server is already available'() {
229229
given:
230-
def cluster = new StableMultiServerCluster(new ClusterId(),
230+
def cluster = new MultiServerCluster(new ClusterId(),
231231
builder().mode(MULTIPLE)
232232
.serverSelectionTimeout(serverSelectionTimeoutMS, MILLISECONDS)
233233
.hosts([firstServer, secondServer, thirdServer])
@@ -250,7 +250,7 @@ class BaseClusterSpecification extends Specification {
250250

251251
def 'should select server asynchronously when server is not yet available'() {
252252
given:
253-
def cluster = new StableMultiServerCluster(new ClusterId(),
253+
def cluster = new MultiServerCluster(new ClusterId(),
254254
builder().mode(MULTIPLE)
255255
.serverSelectionTimeout(serverSelectionTimeoutMS, MILLISECONDS)
256256
.hosts([firstServer, secondServer, thirdServer])
@@ -276,7 +276,7 @@ class BaseClusterSpecification extends Specification {
276276

277277
def 'when selecting server asynchronously should send MongoClientException to callback if cluster is closed before success'() {
278278
given:
279-
def cluster = new StableMultiServerCluster(new ClusterId(),
279+
def cluster = new MultiServerCluster(new ClusterId(),
280280
builder().mode(MULTIPLE)
281281
.hosts([firstServer, secondServer, thirdServer])
282282
.build(),
@@ -296,7 +296,7 @@ class BaseClusterSpecification extends Specification {
296296

297297
def 'when selecting server asynchronously should send MongoTimeoutException to callback after timeout period'() {
298298
given:
299-
def cluster = new StableMultiServerCluster(new ClusterId(),
299+
def cluster = new MultiServerCluster(new ClusterId(),
300300
builder().mode(MULTIPLE)
301301
.hosts([firstServer, secondServer, thirdServer])
302302
.serverSelectionTimeout(serverSelectionTimeoutMS, MILLISECONDS)
@@ -319,7 +319,7 @@ class BaseClusterSpecification extends Specification {
319319

320320
def 'when selecting server asynchronously should send MongoWaitQueueFullException to callback if there are too many waiters'() {
321321
given:
322-
def cluster = new StableMultiServerCluster(new ClusterId(),
322+
def cluster = new MultiServerCluster(new ClusterId(),
323323
builder().mode(MULTIPLE)
324324
.hosts([firstServer, secondServer, thirdServer])
325325
.serverSelectionTimeout(1, SECONDS)

0 commit comments

Comments
 (0)