Search in sources :

Example 1 with Decoder

use of org.bson.codecs.Decoder in project incubator-skywalking by apache.

the class MongoDBMethodInterceptorTest method setUp.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setUp() throws Exception {
    interceptor = new MongoDBMethodInterceptor();
    Config.Plugin.MongoDB.TRACE_PARAM = true;
    when(enhancedInstance.getSkyWalkingDynamicField()).thenReturn("127.0.0.1:27017");
    BsonDocument document = new BsonDocument();
    document.append("name", new BsonString("by"));
    MongoNamespace mongoNamespace = new MongoNamespace("test.user");
    Decoder decoder = PowerMockito.mock(Decoder.class);
    FindOperation findOperation = new FindOperation(mongoNamespace, decoder);
    findOperation.filter(document);
    arguments = new Object[] { findOperation };
    argumentTypes = new Class[] { findOperation.getClass() };
}
Also used : BsonDocument(org.bson.BsonDocument) BsonString(org.bson.BsonString) MongoNamespace(com.mongodb.MongoNamespace) Decoder(org.bson.codecs.Decoder) FindOperation(com.mongodb.operation.FindOperation) Before(org.junit.Before)

Example 2 with Decoder

use of org.bson.codecs.Decoder in project mongo-java-driver by mongodb.

the class CommandOperationHelper method executeRetryableWriteAsync.

static <T, R> void executeRetryableWriteAsync(final AsyncWriteBinding binding, final String database, final ReadPreference readPreference, final FieldNameValidator fieldNameValidator, final Decoder<T> commandResultDecoder, final CommandCreator commandCreator, final CommandWriteTransformerAsync<T, R> transformer, final Function<BsonDocument, BsonDocument> retryCommandModifier, final SingleResultCallback<R> callback) {
    RetryState retryState = initialRetryState(true);
    binding.retain();
    AsyncCallbackSupplier<R> asyncWrite = CommandOperationHelper.<R>decorateWriteWithRetries(retryState, funcCallback -> {
        logRetryExecute(retryState);
        boolean firstAttempt = retryState.isFirstAttempt();
        if (!firstAttempt && binding.getSessionContext().hasActiveTransaction()) {
            binding.getSessionContext().clearTransactionContext();
        }
        withAsyncSourceAndConnection(binding::getWriteConnectionSource, true, funcCallback, (source, connection, releasingCallback) -> {
            int maxWireVersion = connection.getDescription().getMaxWireVersion();
            SingleResultCallback<R> addingRetryableLabelCallback = firstAttempt ? releasingCallback : addingRetryableLabelCallback(releasingCallback, maxWireVersion);
            if (retryState.breakAndCompleteIfRetryAnd(() -> !canRetryWrite(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()), addingRetryableLabelCallback)) {
                return;
            }
            BsonDocument command;
            try {
                command = retryState.attachment(AttachmentKeys.command()).map(previousAttemptCommand -> {
                    assertFalse(firstAttempt);
                    return retryCommandModifier.apply(previousAttemptCommand);
                }).orElseGet(() -> commandCreator.create(source.getServerDescription(), connection.getDescription()));
                // attach `maxWireVersion`, `retryableCommandFlag` ASAP because they are used to check whether we should retry
                retryState.attach(AttachmentKeys.maxWireVersion(), maxWireVersion, true).attach(AttachmentKeys.retryableCommandFlag(), isRetryWritesEnabled(command), true).attach(AttachmentKeys.commandDescriptionSupplier(), command::getFirstKey, true).attach(AttachmentKeys.command(), command, false);
                logRetryExecute(retryState);
            } catch (Throwable t) {
                addingRetryableLabelCallback.onResult(null, t);
                return;
            }
            connection.commandAsync(database, command, fieldNameValidator, readPreference, commandResultDecoder, binding.getSessionContext(), binding.getServerApi(), binding.getRequestContext(), transformingWriteCallback(transformer, connection, addingRetryableLabelCallback));
        });
    }).whenComplete(binding::release);
    asyncWrite.get(exceptionTransformingCallback(errorHandlingCallback(callback, LOGGER)));
}
Also used : AsyncReadBinding(com.mongodb.internal.binding.AsyncReadBinding) ServerDescription(com.mongodb.connection.ServerDescription) MongoClientException(com.mongodb.MongoClientException) Function(com.mongodb.Function) MongoSocketException(com.mongodb.MongoSocketException) ConnectionDescription(com.mongodb.connection.ConnectionDescription) Arrays.asList(java.util.Arrays.asList) MongoNotPrimaryException(com.mongodb.MongoNotPrimaryException) OperationHelper.canRetryRead(com.mongodb.internal.operation.OperationHelper.canRetryRead) MongoNodeIsRecoveringException(com.mongodb.MongoNodeIsRecoveringException) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoException(com.mongodb.MongoException) ConnectionSource(com.mongodb.internal.binding.ConnectionSource) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) ReadBinding(com.mongodb.internal.binding.ReadBinding) Assertions.assertFalse(com.mongodb.assertions.Assertions.assertFalse) MongoServerException(com.mongodb.MongoServerException) String.format(java.lang.String.format) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) PRIVATE(com.mongodb.internal.VisibleForTesting.AccessModifier.PRIVATE) RetryState(com.mongodb.internal.async.function.RetryState) List(java.util.List) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) ResourceSupplierInternalException(com.mongodb.internal.operation.OperationHelper.ResourceSupplierInternalException) ReadPreference.primary(com.mongodb.ReadPreference.primary) RetryingSyncSupplier(com.mongodb.internal.async.function.RetryingSyncSupplier) ReadPreference(com.mongodb.ReadPreference) RetryingAsyncCallbackSupplier(com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier) MongoCommandException(com.mongodb.MongoCommandException) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) WriteBinding(com.mongodb.internal.binding.WriteBinding) Assertions(com.mongodb.assertions.Assertions) MongoConnectionPoolClearedException(com.mongodb.MongoConnectionPoolClearedException) VisibleForTesting(com.mongodb.internal.VisibleForTesting) AsyncWriteBinding(com.mongodb.internal.binding.AsyncWriteBinding) AsyncConnectionSource(com.mongodb.internal.binding.AsyncConnectionSource) FieldNameValidator(org.bson.FieldNameValidator) OperationHelper.canRetryWrite(com.mongodb.internal.operation.OperationHelper.canRetryWrite) BsonDocumentCodec(org.bson.codecs.BsonDocumentCodec) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) Nullable(com.mongodb.lang.Nullable) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) AttachmentKeys(com.mongodb.internal.operation.retry.AttachmentKeys) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) BsonDocument(org.bson.BsonDocument) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) RetryState(com.mongodb.internal.async.function.RetryState)

Example 3 with Decoder

use of org.bson.codecs.Decoder in project mongo-java-driver by mongodb.

the class ListIndexesOperation method executeAsync.

@Override
public void executeAsync(final AsyncReadBinding binding, final SingleResultCallback<AsyncBatchCursor<T>> callback) {
    RetryState retryState = initialRetryState(retryReads);
    binding.retain();
    AsyncCallbackSupplier<AsyncBatchCursor<T>> asyncRead = CommandOperationHelper.<AsyncBatchCursor<T>>decorateReadWithRetries(retryState, funcCallback -> {
        logRetryExecute(retryState);
        withAsyncSourceAndConnection(binding::getReadConnectionSource, false, funcCallback, (source, connection, releasingCallback) -> {
            if (retryState.breakAndCompleteIfRetryAnd(() -> !canRetryRead(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()), releasingCallback)) {
                return;
            }
            if (serverIsAtLeastVersionThreeDotZero(connection.getDescription())) {
                createReadCommandAndExecuteAsync(retryState, binding, source, namespace.getDatabaseName(), getCommandCreator(), createCommandDecoder(), asyncTransformer(), connection, (result, t) -> {
                    if (t != null && !isNamespaceError(t)) {
                        releasingCallback.onResult(null, t);
                    } else {
                        releasingCallback.onResult(result != null ? result : emptyAsyncCursor(source), null);
                    }
                });
            } else {
                retryState.markAsLastAttempt();
                connection.queryAsync(getIndexNamespace(), asQueryDocument(connection.getDescription(), binding.getReadPreference()), null, 0, 0, batchSize, binding.getReadPreference().isSecondaryOk(), false, false, false, false, false, decoder, binding.getRequestContext(), new SingleResultCallback<QueryResult<T>>() {

                    @Override
                    public void onResult(final QueryResult<T> result, final Throwable t) {
                        if (t != null) {
                            releasingCallback.onResult(null, t);
                        } else {
                            releasingCallback.onResult(new AsyncQueryBatchCursor<T>(result, 0, batchSize, 0, decoder, source, connection), null);
                        }
                    }
                });
            }
        });
    }).whenComplete(binding::release);
    asyncRead.get(errorHandlingCallback(callback, LOGGER));
}
Also used : ReadPreference(com.mongodb.ReadPreference) AsyncReadBinding(com.mongodb.internal.binding.AsyncReadBinding) ServerDescription(com.mongodb.connection.ServerDescription) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) CommandOperationHelper.logRetryExecute(com.mongodb.internal.operation.CommandOperationHelper.logRetryExecute) CommandCreator(com.mongodb.internal.operation.CommandOperationHelper.CommandCreator) OperationHelper.cursorDocumentToBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToBatchCursor) MongoCommandException(com.mongodb.MongoCommandException) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) CommandReadTransformer(com.mongodb.internal.operation.CommandOperationHelper.CommandReadTransformer) BsonString(org.bson.BsonString) CommandOperationHelper.createReadCommandAndExecuteAsync(com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecuteAsync) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) ConnectionDescription(com.mongodb.connection.ConnectionDescription) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) SHARD_ROUTER(com.mongodb.connection.ServerType.SHARD_ROUTER) BsonInt64(org.bson.BsonInt64) AsyncConnectionSource(com.mongodb.internal.binding.AsyncConnectionSource) CommandOperationHelper.isNamespaceError(com.mongodb.internal.operation.CommandOperationHelper.isNamespaceError) CursorHelper.getCursorDocumentFromBatchSize(com.mongodb.internal.operation.CursorHelper.getCursorDocumentFromBatchSize) OperationHelper.canRetryRead(com.mongodb.internal.operation.OperationHelper.canRetryRead) OperationHelper.createEmptyBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyBatchCursor) QueryResult(com.mongodb.internal.connection.QueryResult) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoNamespace(com.mongodb.MongoNamespace) ConnectionSource(com.mongodb.internal.binding.ConnectionSource) CommandOperationHelper.createReadCommandAndExecute(com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecute) ReadBinding(com.mongodb.internal.binding.ReadBinding) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) OperationHelper.cursorDocumentToAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToAsyncBatchCursor) CommandOperationHelper.rethrowIfNotNamespaceError(com.mongodb.internal.operation.CommandOperationHelper.rethrowIfNotNamespaceError) CommandOperationHelper.decorateReadWithRetries(com.mongodb.internal.operation.CommandOperationHelper.decorateReadWithRetries) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) TimeUnit(java.util.concurrent.TimeUnit) CommandReadTransformerAsync(com.mongodb.internal.operation.CommandOperationHelper.CommandReadTransformerAsync) RetryState(com.mongodb.internal.async.function.RetryState) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) Codec(org.bson.codecs.Codec) ReadPreference.primary(com.mongodb.ReadPreference.primary) OperationHelper.createEmptyAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyAsyncBatchCursor) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) ServerVersionHelper.serverIsAtLeastVersionThreeDotZero(com.mongodb.internal.operation.ServerVersionHelper.serverIsAtLeastVersionThreeDotZero) QueryResult(com.mongodb.internal.connection.QueryResult) OperationHelper.cursorDocumentToAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToAsyncBatchCursor) AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) OperationHelper.createEmptyAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyAsyncBatchCursor) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) RetryState(com.mongodb.internal.async.function.RetryState)

Example 4 with Decoder

use of org.bson.codecs.Decoder in project mongo-java-driver by mongodb.

the class CryptConnection method commandAsync.

@Override
public <T> void commandAsync(final String database, final BsonDocument command, final FieldNameValidator commandFieldNameValidator, final ReadPreference readPreference, final Decoder<T> commandResultDecoder, final SessionContext sessionContext, final ServerApi serverApi, final RequestContext requestContext, final boolean responseExpected, @Nullable final SplittablePayload payload, @Nullable final FieldNameValidator payloadFieldNameValidator, final SingleResultCallback<T> callback) {
    if (serverIsLessThanVersionFourDotTwo(wrapped.getDescription())) {
        callback.onResult(null, new MongoClientException("Auto-encryption requires a minimum MongoDB version of 4.2"));
        return;
    }
    try {
        BasicOutputBuffer bsonOutput = new BasicOutputBuffer();
        BsonBinaryWriter bsonBinaryWriter = new BsonBinaryWriter(new BsonWriterSettings(), new BsonBinaryWriterSettings(getDescription().getMaxDocumentSize()), bsonOutput, getFieldNameValidator(payload, commandFieldNameValidator, payloadFieldNameValidator));
        BsonWriter writer = payload == null ? bsonBinaryWriter : new SplittablePayloadBsonWriter(bsonBinaryWriter, bsonOutput, createSplittablePayloadMessageSettings(), payload, MAX_SPLITTABLE_DOCUMENT_SIZE);
        getEncoder(command).encode(writer, command, EncoderContext.builder().build());
        crypt.encrypt(database, new RawBsonDocument(bsonOutput.getInternalBuffer(), 0, bsonOutput.getSize())).flatMap((Function<RawBsonDocument, Mono<RawBsonDocument>>) encryptedCommand -> Mono.create(sink -> wrapped.commandAsync(database, encryptedCommand, commandFieldNameValidator, readPreference, new RawBsonDocumentCodec(), sessionContext, serverApi, requestContext, responseExpected, null, null, sinkToCallback(sink)))).flatMap(crypt::decrypt).map(decryptedResponse -> commandResultDecoder.decode(new BsonBinaryReader(decryptedResponse.getByteBuffer().asNIO()), DecoderContext.builder().build())).subscribe(decryptedResult -> callback.onResult(decryptedResult, null), e -> callback.onResult(null, e));
    } catch (Throwable t) {
        callback.onResult(null, t);
    }
}
Also used : ReadPreference(com.mongodb.ReadPreference) InsertRequest(com.mongodb.internal.bulk.InsertRequest) MongoClientException(com.mongodb.MongoClientException) ServerApi(com.mongodb.ServerApi) HashMap(java.util.HashMap) CodecRegistry(org.bson.codecs.configuration.CodecRegistry) SplittablePayloadBsonWriter(com.mongodb.internal.connection.SplittablePayloadBsonWriter) BsonBinaryWriter(org.bson.BsonBinaryWriter) Function(java.util.function.Function) BsonDocument(org.bson.BsonDocument) ConnectionDescription(com.mongodb.connection.ConnectionDescription) Connection(com.mongodb.internal.connection.Connection) Map(java.util.Map) WriteConcernResult(com.mongodb.WriteConcernResult) DeleteRequest(com.mongodb.internal.bulk.DeleteRequest) SessionContext(com.mongodb.internal.session.SessionContext) MappedFieldNameValidator(com.mongodb.internal.validator.MappedFieldNameValidator) FieldNameValidator(org.bson.FieldNameValidator) BsonBinaryWriterSettings(org.bson.BsonBinaryWriterSettings) DecoderContext(org.bson.codecs.DecoderContext) RawBsonDocumentCodec(org.bson.codecs.RawBsonDocumentCodec) EncoderContext(org.bson.codecs.EncoderContext) QueryResult(com.mongodb.internal.connection.QueryResult) MongoNamespace(com.mongodb.MongoNamespace) MessageSettings(com.mongodb.internal.connection.MessageSettings) UpdateRequest(com.mongodb.internal.bulk.UpdateRequest) RawBsonDocument(org.bson.RawBsonDocument) CodecRegistries.fromProviders(org.bson.codecs.configuration.CodecRegistries.fromProviders) BasicOutputBuffer(org.bson.io.BasicOutputBuffer) Mono(reactor.core.publisher.Mono) RequestContext(com.mongodb.RequestContext) BsonValueCodecProvider(org.bson.codecs.BsonValueCodecProvider) ServerVersionHelper.serverIsLessThanVersionFourDotTwo(com.mongodb.internal.operation.ServerVersionHelper.serverIsLessThanVersionFourDotTwo) SplittablePayload(com.mongodb.internal.connection.SplittablePayload) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) List(java.util.List) BsonBinaryReader(org.bson.BsonBinaryReader) Codec(org.bson.codecs.Codec) BsonWriter(org.bson.BsonWriter) MongoOperationPublisher.sinkToCallback(com.mongodb.reactivestreams.client.internal.MongoOperationPublisher.sinkToCallback) Nullable(com.mongodb.lang.Nullable) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) BsonWriterSettings(org.bson.BsonWriterSettings) MongoClientException(com.mongodb.MongoClientException) RawBsonDocumentCodec(org.bson.codecs.RawBsonDocumentCodec) BsonBinaryReader(org.bson.BsonBinaryReader) SplittablePayloadBsonWriter(com.mongodb.internal.connection.SplittablePayloadBsonWriter) BsonWriter(org.bson.BsonWriter) RawBsonDocument(org.bson.RawBsonDocument) Function(java.util.function.Function) SplittablePayloadBsonWriter(com.mongodb.internal.connection.SplittablePayloadBsonWriter) BsonBinaryWriter(org.bson.BsonBinaryWriter) BsonBinaryWriterSettings(org.bson.BsonBinaryWriterSettings) BsonWriterSettings(org.bson.BsonWriterSettings) BasicOutputBuffer(org.bson.io.BasicOutputBuffer)

Example 5 with Decoder

use of org.bson.codecs.Decoder in project mongo-java-driver by mongodb.

the class CommandOperationHelper method executeRetryableWrite.

static <T, R> R executeRetryableWrite(final WriteBinding binding, final String database, final ReadPreference readPreference, final FieldNameValidator fieldNameValidator, final Decoder<T> commandResultDecoder, final CommandCreator commandCreator, final CommandWriteTransformer<T, R> transformer, final Function<BsonDocument, BsonDocument> retryCommandModifier) {
    RetryState retryState = initialRetryState(true);
    Supplier<R> retryingWrite = decorateWriteWithRetries(retryState, () -> {
        logRetryExecute(retryState);
        boolean firstAttempt = retryState.isFirstAttempt();
        if (!firstAttempt && binding.getSessionContext().hasActiveTransaction()) {
            binding.getSessionContext().clearTransactionContext();
        }
        return withSourceAndConnection(binding::getWriteConnectionSource, true, (source, connection) -> {
            int maxWireVersion = connection.getDescription().getMaxWireVersion();
            try {
                retryState.breakAndThrowIfRetryAnd(() -> !canRetryWrite(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()));
                BsonDocument command = retryState.attachment(AttachmentKeys.command()).map(previousAttemptCommand -> {
                    assertFalse(firstAttempt);
                    return retryCommandModifier.apply(previousAttemptCommand);
                }).orElseGet(() -> commandCreator.create(source.getServerDescription(), connection.getDescription()));
                // attach `maxWireVersion`, `retryableCommandFlag` ASAP because they are used to check whether we should retry
                retryState.attach(AttachmentKeys.maxWireVersion(), maxWireVersion, true).attach(AttachmentKeys.retryableCommandFlag(), isRetryWritesEnabled(command), true).attach(AttachmentKeys.commandDescriptionSupplier(), command::getFirstKey, true).attach(AttachmentKeys.command(), command, false);
                logRetryExecute(retryState);
                return transformer.apply(connection.command(database, command, fieldNameValidator, readPreference, commandResultDecoder, binding.getSessionContext(), binding.getServerApi(), binding.getRequestContext()), connection);
            } catch (MongoException e) {
                if (!firstAttempt) {
                    addRetryableWriteErrorLabel(e, maxWireVersion);
                }
                throw e;
            }
        });
    });
    try {
        return retryingWrite.get();
    } catch (MongoException e) {
        throw transformWriteException(e);
    }
}
Also used : AsyncReadBinding(com.mongodb.internal.binding.AsyncReadBinding) ServerDescription(com.mongodb.connection.ServerDescription) MongoClientException(com.mongodb.MongoClientException) Function(com.mongodb.Function) MongoSocketException(com.mongodb.MongoSocketException) ConnectionDescription(com.mongodb.connection.ConnectionDescription) Arrays.asList(java.util.Arrays.asList) MongoNotPrimaryException(com.mongodb.MongoNotPrimaryException) OperationHelper.canRetryRead(com.mongodb.internal.operation.OperationHelper.canRetryRead) MongoNodeIsRecoveringException(com.mongodb.MongoNodeIsRecoveringException) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoException(com.mongodb.MongoException) ConnectionSource(com.mongodb.internal.binding.ConnectionSource) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) ReadBinding(com.mongodb.internal.binding.ReadBinding) Assertions.assertFalse(com.mongodb.assertions.Assertions.assertFalse) MongoServerException(com.mongodb.MongoServerException) String.format(java.lang.String.format) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) PRIVATE(com.mongodb.internal.VisibleForTesting.AccessModifier.PRIVATE) RetryState(com.mongodb.internal.async.function.RetryState) List(java.util.List) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) ResourceSupplierInternalException(com.mongodb.internal.operation.OperationHelper.ResourceSupplierInternalException) ReadPreference.primary(com.mongodb.ReadPreference.primary) RetryingSyncSupplier(com.mongodb.internal.async.function.RetryingSyncSupplier) ReadPreference(com.mongodb.ReadPreference) RetryingAsyncCallbackSupplier(com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier) MongoCommandException(com.mongodb.MongoCommandException) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) WriteBinding(com.mongodb.internal.binding.WriteBinding) Assertions(com.mongodb.assertions.Assertions) MongoConnectionPoolClearedException(com.mongodb.MongoConnectionPoolClearedException) VisibleForTesting(com.mongodb.internal.VisibleForTesting) AsyncWriteBinding(com.mongodb.internal.binding.AsyncWriteBinding) AsyncConnectionSource(com.mongodb.internal.binding.AsyncConnectionSource) FieldNameValidator(org.bson.FieldNameValidator) OperationHelper.canRetryWrite(com.mongodb.internal.operation.OperationHelper.canRetryWrite) BsonDocumentCodec(org.bson.codecs.BsonDocumentCodec) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) Nullable(com.mongodb.lang.Nullable) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) AttachmentKeys(com.mongodb.internal.operation.retry.AttachmentKeys) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) MongoException(com.mongodb.MongoException) BsonDocument(org.bson.BsonDocument) RetryState(com.mongodb.internal.async.function.RetryState)

Aggregations

BsonDocument (org.bson.BsonDocument)7 Decoder (org.bson.codecs.Decoder)7 ReadPreference (com.mongodb.ReadPreference)6 ConnectionDescription (com.mongodb.connection.ConnectionDescription)6 SingleResultCallback (com.mongodb.internal.async.SingleResultCallback)6 AsyncConnection (com.mongodb.internal.connection.AsyncConnection)6 Connection (com.mongodb.internal.connection.Connection)6 MongoCommandException (com.mongodb.MongoCommandException)5 ReadPreference.primary (com.mongodb.ReadPreference.primary)5 Assertions.notNull (com.mongodb.assertions.Assertions.notNull)5 ServerDescription (com.mongodb.connection.ServerDescription)5 ErrorHandlingResultCallback.errorHandlingCallback (com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback)5 AsyncCallbackSupplier (com.mongodb.internal.async.function.AsyncCallbackSupplier)5 RetryState (com.mongodb.internal.async.function.RetryState)5 AsyncConnectionSource (com.mongodb.internal.binding.AsyncConnectionSource)5 AsyncReadBinding (com.mongodb.internal.binding.AsyncReadBinding)5 ConnectionSource (com.mongodb.internal.binding.ConnectionSource)5 ReadBinding (com.mongodb.internal.binding.ReadBinding)5 LOGGER (com.mongodb.internal.operation.OperationHelper.LOGGER)5 OperationHelper.canRetryRead (com.mongodb.internal.operation.OperationHelper.canRetryRead)5