Search in sources :

Example 6 with AsyncConnection

use of com.mongodb.connection.AsyncConnection in project mongo-java-driver by mongodb.

the class OperationHelper method validateIndexRequestCollations.

static void validateIndexRequestCollations(final AsyncConnection connection, final List<IndexRequest> requests, final AsyncCallableWithConnection callable) {
    boolean calledTheCallable = false;
    for (IndexRequest request : requests) {
        if (request.getCollation() != null) {
            calledTheCallable = true;
            validateCollation(connection, request.getCollation(), new AsyncCallableWithConnection() {

                @Override
                public void call(final AsyncConnection connection, final Throwable t) {
                    callable.call(connection, t);
                }
            });
            break;
        }
    }
    if (!calledTheCallable) {
        callable.call(connection, null);
    }
}
Also used : AsyncConnection(com.mongodb.connection.AsyncConnection) IndexRequest(com.mongodb.bulk.IndexRequest)

Aggregations

AsyncConnection (com.mongodb.connection.AsyncConnection)6 Test (org.junit.Test)3 SingleResultCallback (com.mongodb.async.SingleResultCallback)1 DeleteRequest (com.mongodb.bulk.DeleteRequest)1 IndexRequest (com.mongodb.bulk.IndexRequest)1 UpdateRequest (com.mongodb.bulk.UpdateRequest)1 WriteRequest (com.mongodb.bulk.WriteRequest)1 Collation (com.mongodb.client.model.Collation)1 BulkWriteBatchCombiner (com.mongodb.connection.BulkWriteBatchCombiner)1 AsyncCallableWithConnection (com.mongodb.operation.OperationHelper.AsyncCallableWithConnection)1