55
55
import static com .mongodb .internal .operation .CommandBatchCursorHelper .MESSAGE_IF_CONCURRENT_OPERATION ;
56
56
import static com .mongodb .internal .operation .CommandBatchCursorHelper .NEXT_BATCH ;
57
57
import static com .mongodb .internal .operation .CommandBatchCursorHelper .NO_OP_FIELD_NAME_VALIDATOR ;
58
- import static com .mongodb .internal .operation .CommandBatchCursorHelper .getCommandCursorResult ;
58
+ import static com .mongodb .internal .operation .CommandBatchCursorHelper .logCommandCursorResult ;
59
59
import static com .mongodb .internal .operation .CommandBatchCursorHelper .getKillCursorsCommand ;
60
60
import static com .mongodb .internal .operation .CommandBatchCursorHelper .getMoreCommandDocument ;
61
61
import static com .mongodb .internal .operation .CommandBatchCursorHelper .translateCommandException ;
@@ -233,7 +233,9 @@ private void getMoreLoop(final AsyncConnection connection, final ServerCursor se
233
233
234
234
private CommandCursorResult <T > toCommandCursorResult (final ServerAddress serverAddress , final String fieldNameContainingBatch ,
235
235
final BsonDocument commandCursorDocument ) {
236
- CommandCursorResult <T > commandCursorResult = getCommandCursorResult (serverAddress , fieldNameContainingBatch , commandCursorDocument );
236
+ CommandCursorResult <T > commandCursorResult = new CommandCursorResult <>(serverAddress , fieldNameContainingBatch ,
237
+ commandCursorDocument );
238
+ logCommandCursorResult (commandCursorResult );
237
239
this .count .addAndGet (commandCursorResult .getResults ().size ());
238
240
return commandCursorResult ;
239
241
}
@@ -279,7 +281,6 @@ void doClose() {
279
281
}
280
282
281
283
if (getServerCursor () != null ) {
282
- // Don't handle corrupted connections
283
284
getConnection ((connection , t ) -> {
284
285
if (connection != null ) {
285
286
releaseServerAndClientResources (connection , (r , t1 ) -> connection .release ());
@@ -299,11 +300,11 @@ <R> void executeWithConnection(final AsyncCallableConnectionWithCallback<R> call
299
300
callback .onResult (null , t );
300
301
return ;
301
302
}
302
- callable .call (connection , (result , t1 ) -> {
303
+ callable .call (assertNotNull ( connection ) , (result , t1 ) -> {
303
304
if (t1 instanceof MongoSocketException ) {
304
305
onCorruptedConnection (connection , (MongoSocketException ) t1 );
305
306
}
306
- assertNotNull ( connection ) .release ();
307
+ connection .release ();
307
308
callback .onResult (result , t1 );
308
309
});
309
310
});
0 commit comments