use of com.mongodb.internal.binding.AsyncClusterAwareReadWriteBinding in project mongo-java-driver by mongodb.
the class OperationExecutorImpl method getReadWriteBinding.
private AsyncReadWriteBinding getReadWriteBinding(final RequestContext requestContext, final ReadPreference readPreference, final ReadConcern readConcern, @Nullable final ClientSession session, final boolean ownsSession) {
notNull("readPreference", readPreference);
AsyncClusterAwareReadWriteBinding readWriteBinding = new AsyncClusterBinding(mongoClient.getCluster(), getReadPreferenceForBinding(readPreference, session), readConcern, mongoClient.getSettings().getServerApi(), requestContext);
Crypt crypt = mongoClient.getCrypt();
if (crypt != null) {
readWriteBinding = new CryptBinding(readWriteBinding, crypt);
}
final AsyncClusterAwareReadWriteBinding asyncReadWriteBinding = readWriteBinding;
if (session != null) {
return new ClientSessionBinding(session.getWrapped(), ownsSession, asyncReadWriteBinding);
} else {
return asyncReadWriteBinding;
}
}
Aggregations