Skip to content

Commit bfdf0d5

Browse files
committed
Ternary ifs ftw
1 parent 8d9f3b1 commit bfdf0d5

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

driver-core/src/main/com/mongodb/internal/operation/AsyncCommandBatchCursor.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ class AsyncCommandBatchCursor<T> implements AsyncAggregateResponseBatchCursor<T>
9090
this.maxWireVersion = connectionDescription.getMaxWireVersion();
9191
this.firstBatchEmpty = commandCursorResult.getResults().isEmpty();
9292

93-
AsyncConnection connectionToPin = null;
94-
if (connectionDescription.getServerType() == ServerType.LOAD_BALANCER) {
95-
connectionToPin = connection;
96-
}
97-
93+
AsyncConnection connectionToPin = connectionDescription.getServerType() == ServerType.LOAD_BALANCER ? connection : null;
9894
resourceManager = new ResourceManager(namespace, connectionSource, connectionToPin, commandCursorResult.getServerCursor());
9995
}
10096

driver-core/src/main/com/mongodb/internal/operation/CommandBatchCursor.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ class CommandBatchCursor<T> implements AggregateResponseBatchCursor<T> {
8989
this.maxWireVersion = connectionDescription.getMaxWireVersion();
9090
this.firstBatchEmpty = commandCursorResult.getResults().isEmpty();
9191

92-
Connection connectionToPin = null;
93-
if (connectionDescription.getServerType() == ServerType.LOAD_BALANCER) {
94-
connectionToPin = connection;
95-
}
96-
92+
Connection connectionToPin = connectionDescription.getServerType() == ServerType.LOAD_BALANCER ? connection : null;
9793
resourceManager = new ResourceManager(namespace, connectionSource, connectionToPin, commandCursorResult.getServerCursor());
9894
}
9995

0 commit comments

Comments
 (0)