@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<Void> callback) { withConnection(binding, new OperationHelper.AsyncCallableWithConnection() { @Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { executeWrappedCommandProtocolAsync(binding, databaseName, getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), releasingCallback(errHandlingCallback, connection)); } } }); }
@Override public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<Void> callback) { withConnection(binding, new OperationHelper.AsyncCallableWithConnection() { @Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { executeWrappedCommandProtocolAsync(binding, "admin", getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), releasingCallback(errHandlingCallback, connection)); } } }); }
@Override public Void call(final Connection connection) { validateCollation(connection, collation); executeWrappedCommandProtocol(binding, databaseName, getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); return null; } });
@Override public Void call(final Connection connection) { try { executeWrappedCommandProtocol(binding, databaseName, getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { translateUserCommandException(e); } return null; } });
@Override public Void call(final Connection connection) { try { executeWrappedCommandProtocol(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { rethrowIfNotNamespaceError(e); } return null; } });
@Override public Void call(final Connection connection) { if (!serverIsAtLeastVersionThreeDotFour(connection.getDescription())) { throw createExceptionForIncompatibleServerVersion(); } executeWrappedCommandProtocol(binding, databaseName, getCommand(connection.getDescription()), writeConcernErrorTransformer()); return null; } });
@Override public Void call(final Connection connection) { validateCollation(connection, collation); return executeWrappedCommandProtocol(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } });
@Override public Void call(final Connection connection) { try { validateIndexRequestCollations(connection, requests); executeWrappedCommandProtocol(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { throw checkForDuplicateKeyError(e); } return null; } });
@Override public Void call(final Connection connection) { try { executeWrappedCommandProtocol(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { CommandOperationHelper.rethrowIfNotNamespaceError(e); } return null; } });
@Override public Void call(final Connection connection) { try { executeWrappedCommandProtocol(binding, getCredential().getSource(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { translateUserCommandException(e); } return null; } });
@Override public Void call(final Connection connection) { try { executeWrappedCommandProtocol(binding, getCredential().getSource(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } catch (MongoCommandException e) { translateUserCommandException(e); } return null; } });
@Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { final SingleResultCallback<Void> wrappedCallback = releasingCallback(errHandlingCallback, connection); executeWrappedCommandProtocolAsync(binding, databaseName, getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), userCommandCallback(wrappedCallback)); } } });
@Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { final SingleResultCallback<Void> wrappedCallback = releasingCallback(errHandlingCallback, connection); executeWrappedCommandProtocolAsync(binding, credential.getSource(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), userCommandCallback(wrappedCallback)); } } });
@Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { final SingleResultCallback<Void> wrappedCallback = releasingCallback(errHandlingCallback, connection); executeWrappedCommandProtocolAsync(binding, credential.getSource(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), userCommandCallback(wrappedCallback)); } } });
@Override public Void execute(final WriteBinding binding) { isTrue("in transaction", binding.getSessionContext().hasActiveTransaction()); return executeRetryableCommand(binding, "admin", null, new NoOpFieldNameValidator(), new BsonDocumentCodec(), getCommandCreator(), writeConcernErrorTransformer()); }
@Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { final SingleResultCallback<Void> releasingCallback = releasingCallback(errHandlingCallback, connection); executeWrappedCommandProtocolAsync(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { if (t != null && !isNamespaceError(t)) { releasingCallback.onResult(null, t); } else { releasingCallback.onResult(result, null); } } }); } } });
@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 AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { final SingleResultCallback<Void> releasingCallback = releasingCallback(errHandlingCallback, connection); executeWrappedCommandProtocolAsync(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), new SingleResultCallback<Void>() { @Override public void onResult(final Void result, final Throwable t) { if (t != null && !isNamespaceError(t)) { releasingCallback.onResult(null, t); } else { releasingCallback.onResult(result, null); } } }); } } });
@Override public void call(final AsyncConnection connection, final Throwable t) { SingleResultCallback<Void> errHandlingCallback = errorHandlingCallback(callback, LOGGER); if (t != null) { errHandlingCallback.onResult(null, t); } else { SingleResultCallback<Void> wrappedCallback = releasingCallback(errHandlingCallback, connection); if (!serverIsAtLeastVersionThreeDotFour(connection.getDescription())) { wrappedCallback.onResult(null, createExceptionForIncompatibleServerVersion()); } executeWrappedCommandProtocolAsync(binding, databaseName, getCommand(connection.getDescription()), connection, writeConcernErrorTransformer(), wrappedCallback); } } });
@Override public Void call(final Connection connection) { validateCollation(connection, collation); return executeWrappedCommandProtocol(binding, namespace.getDatabaseName(), getCommand(connection.getDescription()), connection, writeConcernErrorTransformer()); } });