File tree Expand file tree Collapse file tree
driver-core/src/main/com/mongodb/internal
driver-sync/src/test/functional/com/mongodb/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868import static com .mongodb .connection .ServerDescription .MIN_DRIVER_WIRE_VERSION ;
6969import static com .mongodb .internal .Locks .withInterruptibleLock ;
7070import static com .mongodb .internal .VisibleForTesting .AccessModifier .PRIVATE ;
71- import static com .mongodb .internal .VisibleForTesting .AccessModifier .PROTECTED ;
7271import static com .mongodb .internal .connection .EventHelper .wouldDescriptionsGenerateEquivalentEvents ;
7372import static com .mongodb .internal .event .EventListenerHelper .singleClusterListener ;
7473import static com .mongodb .internal .logging .LogMessage .Component .SERVER_SELECTION ;
9594import static java .util .concurrent .TimeUnit .NANOSECONDS ;
9695import static java .util .stream .Collectors .toList ;
9796
98- @ VisibleForTesting (otherwise = PROTECTED )
99- public abstract class BaseCluster implements Cluster {
97+ abstract class BaseCluster implements Cluster {
10098 private static final Logger LOGGER = Loggers .getLogger ("cluster" );
10199 private static final StructuredLogger STRUCTURED_LOGGER = new StructuredLogger ("cluster" );
102100
Original file line number Diff line number Diff line change @@ -241,8 +241,7 @@ ServerSelector apply(final ServerSelector wrappedSelector) {
241241 return new DeprioritizingSelector (wrappedSelector );
242242 }
243243
244- @ VisibleForTesting (otherwise = PACKAGE )
245- public void updateCandidate (final ServerAddress serverAddress , final ClusterType clusterType ) {
244+ void updateCandidate (final ServerAddress serverAddress , final ClusterType clusterType ) {
246245 this .candidate = serverAddress ;
247246 this .clusterType = clusterType ;
248247 }
@@ -253,7 +252,7 @@ public void onAttemptFailure(final Throwable failure) {
253252 return ;
254253 }
255254
256- boolean isSystemOverloadedError = failure instanceof MongoException
255+ boolean isSystemOverloadedError = failure instanceof MongoException
257256 && ((MongoException ) failure ).hasErrorLabel (SYSTEM_OVERLOADED_ERROR_LABEL );
258257 if (clusterType == ClusterType .SHARDED || isSystemOverloadedError ) {
259258 deprioritized .add (candidate );
Original file line number Diff line number Diff line change @@ -73,7 +73,9 @@ final class AsyncChangeStreamBatchCursor<T> implements AsyncAggregateResponseBat
7373 this .wrapped = new AtomicReference <>(assertNotNull (wrapped ));
7474 this .binding = binding ;
7575 binding .retain ();
76- this .initialOperationContext = operationContext .withOverride (TimeoutContext ::withMaxTimeAsMaxAwaitTimeOverride );
76+ this .initialOperationContext = operationContext
77+ .withOverride (TimeoutContext ::withMaxTimeAsMaxAwaitTimeOverride )
78+ .withNewServerDeprioritization ();
7779 this .resumeToken = resumeToken ;
7880 this .maxWireVersion = maxWireVersion ;
7981 isClosed = new AtomicBoolean ();
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public abstract class AbstractRetryableReadsProseTest {
5353
5454 private static final String COLLECTION_NAME = "test" ;
5555
56- protected abstract MongoClient createClient (final MongoClientSettings settings );
56+ protected abstract MongoClient createClient (MongoClientSettings settings );
5757
5858 @ AfterEach
5959 void afterEach () {
You can’t perform that action at this time.
0 commit comments