static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final Decoder<BsonDocument> decoder, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, decoder, connection, primary(), transformer, binding.getSessionContext(), callback); }
static <D, T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final FieldNameValidator fieldNameValidator, final Decoder<D> decoder, final CommandTransformer<D, T> transformer, final SingleResultCallback<T> callback) { binding.getWriteConnectionSource(new CommandProtocolExecutingCallback<D, T>(database, command, fieldNameValidator, decoder, primary(), transformer, binding.getSessionContext(), errorHandlingCallback(callback, LOGGER))); }
final SingleResultCallback<R> originalCallback) { final SingleResultCallback<R> errorHandlingCallback = errorHandlingCallback(originalCallback, LOGGER); binding.getWriteConnectionSource(new SingleResultCallback<AsyncConnectionSource>() { @Override public void onResult(final AsyncConnectionSource source, final Throwable t) {
static void withConnection(final AsyncWriteBinding binding, final AsyncCallableWithConnectionAndSource callable) { binding.getWriteConnectionSource(errorHandlingCallback(new AsyncCallableWithConnectionAndSourceCallback(callable), LOGGER)); }
static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final FieldNameValidator fieldNameValidator, final Decoder<BsonDocument> decoder, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, fieldNameValidator, decoder, connection, primary(), transformer, binding.getSessionContext(), callback); }
static <D, T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final FieldNameValidator fieldNameValidator, final Decoder<D> decoder, final CommandTransformer<D, T> transformer, final SingleResultCallback<T> callback) { binding.getWriteConnectionSource(new CommandProtocolExecutingCallback<D, T>(database, command, fieldNameValidator, decoder, primary(), transformer, binding.getSessionContext(), errorHandlingCallback(callback, LOGGER))); }
static void withConnection(final AsyncWriteBinding binding, final AsyncCallableWithConnection callable) { binding.getWriteConnectionSource(errorHandlingCallback(new AsyncCallableWithConnectionCallback(callable), LOGGER)); }
static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, new BsonDocumentCodec(), connection, primary(), transformer, binding.getSessionContext(), callback); }
final SingleResultCallback<R> originalCallback) { final SingleResultCallback<R> errorHandlingCallback = errorHandlingCallback(originalCallback, LOGGER); binding.getWriteConnectionSource(new SingleResultCallback<AsyncConnectionSource>() { @Override public void onResult(final AsyncConnectionSource source, final Throwable t) {
@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<T> callback) { executeRetryableCommand(binding, getDatabaseName(), null, getFieldNameValidator(), CommandResultDocumentCodec.create(getDecoder(), "value"), getCommandCreator(binding.getSessionContext()), FindAndModifyHelper.<T>transformer(), callback); }
static void withConnection(final AsyncWriteBinding binding, final AsyncCallableWithConnectionAndSource callable) { binding.getWriteConnectionSource(errorHandlingCallback(new AsyncCallableWithConnectionAndSourceCallback(callable), LOGGER)); }
private void executeCommandAsync(final AsyncWriteBinding binding, final AsyncConnection connection, final BulkWriteBatch batch, final ConnectionReleasingWrappedCallback<BulkWriteResult> callback, final SingleResultCallback<BsonDocument> commandCallback) { try { connection.commandAsync(namespace.getDatabaseName(), batch.getCommand(), NO_OP_FIELD_NAME_VALIDATOR, null, batch.getDecoder(), binding.getSessionContext(), shouldAcknowledge(batch, writeConcern), batch.getPayload(), batch.getFieldNameValidator(), commandCallback); } catch (Throwable t) { callback.onResult(null, t); } }
static void withConnection(final AsyncWriteBinding binding, final AsyncCallableWithConnection callable) { binding.getWriteConnectionSource(errorHandlingCallback(new AsyncCallableWithConnectionCallback(callable), LOGGER)); }
@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<Void> callback) { isTrue("in transaction", binding.getSessionContext().hasActiveTransaction()); executeRetryableCommand(binding, "admin", null, new NoOpFieldNameValidator(), new BsonDocumentCodec(), getCommandCreator(), writeConcernErrorTransformer(), errorHandlingCallback(callback, LOGGER)); }
@Override public void call(final AsyncConnectionSource source, final AsyncConnection connection, final Throwable t) { if (t != null) { callback.onResult(null, originalError); } else { final ConnectionReleasingWrappedCallback<BulkWriteResult> releasingCallback = new ConnectionReleasingWrappedCallback<BulkWriteResult>(callback, source, connection); if (!isRetryableWrite(retryWrites, writeConcern, source.getServerDescription(), connection.getDescription(), binding.getSessionContext())) { checkMongoWriteConcernWithResponseException(connection, releasingCallback); } else { executeCommandAsync(binding, connection, retryBatch, releasingCallback, new SingleResultCallback<BsonDocument>() { @Override public void onResult(final BsonDocument result, final Throwable t) { if (t != null) { checkMongoWriteConcernWithResponseException(connection, releasingCallback); } else { getCommandCallback(binding, connection, retryBatch, true, true, releasingCallback) .onResult(result, null); } } }); } } }
static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final Decoder<BsonDocument> decoder, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, decoder, connection, primary(), transformer, binding.getSessionContext(), callback); }
static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final FieldNameValidator fieldNameValidator, final Decoder<BsonDocument> decoder, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, fieldNameValidator, decoder, connection, primary(), transformer, binding.getSessionContext(), callback); }
static <T> void executeWrappedCommandProtocolAsync(final AsyncWriteBinding binding, final String database, final BsonDocument command, final AsyncConnection connection, final CommandTransformer<BsonDocument, T> transformer, final SingleResultCallback<T> callback) { notNull("binding", binding); executeWrappedCommandProtocolAsync(database, command, new BsonDocumentCodec(), connection, primary(), transformer, binding.getSessionContext(), callback); }
@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<T> callback) { executeRetryableCommand(binding, getDatabaseName(), null, getFieldNameValidator(), CommandResultDocumentCodec.create(getDecoder(), "value"), getCommandCreator(binding.getSessionContext()), FindAndModifyHelper.<T>transformer(), callback); }
@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<Void> callback) { isTrue("in transaction", binding.getSessionContext().hasActiveTransaction()); executeRetryableCommand(binding, "admin", null, new NoOpFieldNameValidator(), new BsonDocumentCodec(), getCommandCreator(), writeConcernErrorTransformer(), errorHandlingCallback(callback, LOGGER)); }