use of com.mongodb.internal.binding.AsyncClusterBinding in project mongo-java-driver by mongodb.
the class ClusterFixture method getAsyncBinding.
public static AsyncReadWriteBinding getAsyncBinding(final Cluster cluster, final ReadPreference readPreference) {
if (!asyncBindingMap.containsKey(readPreference)) {
AsyncReadWriteBinding binding = new AsyncClusterBinding(cluster, readPreference, ReadConcern.DEFAULT, getServerApi(), IgnorableRequestContext.INSTANCE);
if (serverVersionAtLeast(3, 6)) {
binding = new AsyncSessionBinding(binding);
}
asyncBindingMap.put(readPreference, binding);
}
return asyncBindingMap.get(readPreference);
}
use of com.mongodb.internal.binding.AsyncClusterBinding 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