Search in sources :

Example 1 with AsyncClusterAwareReadWriteBinding

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;
    }
}
Also used : AsyncClusterBinding(com.mongodb.internal.binding.AsyncClusterBinding) Crypt(com.mongodb.reactivestreams.client.internal.crypt.Crypt) CryptBinding(com.mongodb.reactivestreams.client.internal.crypt.CryptBinding) AsyncClusterAwareReadWriteBinding(com.mongodb.internal.binding.AsyncClusterAwareReadWriteBinding) ClientSessionBinding(com.mongodb.internal.async.client.ClientSessionBinding)

Aggregations

ClientSessionBinding (com.mongodb.internal.async.client.ClientSessionBinding)1 AsyncClusterAwareReadWriteBinding (com.mongodb.internal.binding.AsyncClusterAwareReadWriteBinding)1 AsyncClusterBinding (com.mongodb.internal.binding.AsyncClusterBinding)1 Crypt (com.mongodb.reactivestreams.client.internal.crypt.Crypt)1 CryptBinding (com.mongodb.reactivestreams.client.internal.crypt.CryptBinding)1