use of com.mongodb.operation.OperationHelper.AsyncCallableWithConnection in project mongo-java-driver by mongodb.
the class MixedBulkWriteOperation method executeAsync.
@Override
public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<BulkWriteResult> callback) {
withConnection(binding, new AsyncCallableWithConnection() {
@Override
public void call(final AsyncConnection connection, final Throwable t) {
final SingleResultCallback<BulkWriteResult> errHandlingCallback = errorHandlingCallback(callback, LOGGER);
if (t != null) {
errHandlingCallback.onResult(null, t);
} else {
validateWriteRequests(connection, bypassDocumentValidation, writeRequests, writeConcern, new AsyncCallableWithConnection() {
@Override
public void call(final AsyncConnection connection, final Throwable t) {
if (t != null) {
releasingCallback(errHandlingCallback, connection).onResult(null, t);
} else {
Iterator<Run> runs = getRunGenerator(connection.getDescription()).iterator();
executeRunsAsync(runs, connection, new BulkWriteBatchCombiner(connection.getDescription().getServerAddress(), ordered, writeConcern), errHandlingCallback);
}
}
});
}
}
});
}
Aggregations