File tree Expand file tree Collapse file tree
driver-core/src/main/com/mongodb/internal/connection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,21 +285,26 @@ private DeprioritizingSelector(final ServerSelector wrappedSelector) {
285285 public List <ServerDescription > select (final ClusterDescription clusterDescription ) {
286286 List <ServerDescription > serverDescriptions = clusterDescription .getServerDescriptions ();
287287
288+ // TODO-JAVA-5908: Evaluate whether the early-return optimization a meaningful performance impact on server selection.
288289 if (serverDescriptions .size () == 1 || deprioritized .isEmpty ()) {
289290 return wrappedSelector .select (clusterDescription );
290291 }
291292
293+ // TODO-JAVA-5908: Evaluate whether using a loop instead of Stream a meaningful performance impact on server selection.
292294 List <ServerDescription > nonDeprioritizedServerDescriptions = serverDescriptions
293295 .stream ()
294296 .filter (serverDescription -> !deprioritized .contains (serverDescription .getAddress ()))
295297 .collect (toList ());
296298
299+ // TODO-JAVA-5908: Evaluate whether the early-return optimization a meaningful performance impact on server selection.
297300 if (nonDeprioritizedServerDescriptions .isEmpty ()) {
298301 return wrappedSelector .select (clusterDescription );
299302 }
300303
301304 List <ServerDescription > selected = wrappedSelector .select (
302- new ClusterDescription (clusterDescription .getConnectionMode (), clusterDescription .getType (),
305+ new ClusterDescription (
306+ clusterDescription .getConnectionMode (),
307+ clusterDescription .getType (),
303308 nonDeprioritizedServerDescriptions ,
304309 clusterDescription .getClusterSettings (),
305310 clusterDescription .getServerSettings ()));
You can’t perform that action at this time.
0 commit comments