Skip to content

Commit df84c84

Browse files
committed
Use ReadConcernAwareNoOpSessionContext instead of NoOpSessionContext
1 parent 0e9e56b commit df84c84

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

driver-core/src/main/com/mongodb/internal/connection/Authenticator.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,18 @@ abstract void authenticateAsync(InternalConnection connection, ConnectionDescrip
103103
OperationContext operationContext, SingleResultCallback<Void> callback);
104104

105105
public void reauthenticate(final InternalConnection connection, final OperationContext operationContext) {
106-
authenticate(connection, connection.getDescription(), operationContext.withSessionContext(NoOpSessionContext.INSTANCE));
106+
authenticate(connection, connection.getDescription(), operationContextWithoutSession(operationContext));
107107
}
108108

109109
public void reauthenticateAsync(final InternalConnection connection, final OperationContext operationContext,
110110
final SingleResultCallback<Void> callback) {
111111
beginAsync().thenRun((c) -> {
112-
authenticateAsync(connection, connection.getDescription(), operationContext.withSessionContext(NoOpSessionContext.INSTANCE), c);
112+
authenticateAsync(connection, connection.getDescription(), operationContextWithoutSession(operationContext), c);
113113
}).finish(callback);
114114
}
115+
116+
private static OperationContext operationContextWithoutSession(final OperationContext operationContext) {
117+
return operationContext.withSessionContext(
118+
new ReadConcernAwareNoOpSessionContext(operationContext.getSessionContext().getReadConcern()));
119+
}
115120
}

0 commit comments

Comments
 (0)