public class MixedBulkWriteOperation extends java.lang.Object implements AsyncWriteOperation<BulkWriteResult>, WriteOperation<BulkWriteResult>
Modifier and Type | Field and Description |
---|---|
private java.lang.Boolean |
bypassDocumentValidation |
private MongoNamespace |
namespace |
private static FieldNameValidator |
NO_OP_FIELD_NAME_VALIDATOR |
private boolean |
ordered |
private boolean |
retryWrites |
private WriteConcern |
writeConcern |
private java.util.List<? extends WriteRequest> |
writeRequests |
Constructor and Description |
---|
MixedBulkWriteOperation(MongoNamespace namespace,
java.util.List<? extends WriteRequest> writeRequests,
boolean ordered,
WriteConcern writeConcern)
Deprecated.
|
MixedBulkWriteOperation(MongoNamespace namespace,
java.util.List<? extends WriteRequest> writeRequests,
boolean ordered,
WriteConcern writeConcern,
boolean retryWrites)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
MixedBulkWriteOperation |
bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
Sets the bypass document level validation flag.
|
BulkWriteResult |
execute(WriteBinding binding)
Executes a bulk write operation.
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<BulkWriteResult> callback)
General execute which can return anything of type T
|
private void |
executeBatchesAsync(AsyncWriteBinding binding,
AsyncConnection connection,
BulkWriteBatch batch,
boolean retryWrites,
OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback) |
private BulkWriteResult |
executeBulkWriteBatch(WriteBinding binding,
Connection connection,
BulkWriteBatch originalBatch) |
private BsonDocument |
executeCommand(Connection connection,
BulkWriteBatch batch,
WriteBinding binding) |
private void |
executeCommandAsync(AsyncWriteBinding binding,
AsyncConnection connection,
BulkWriteBatch batch,
OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback,
SingleResultCallback<BsonDocument> commandCallback) |
private BulkWriteResult |
executeLegacyBatches(Connection connection) |
private void |
executeLegacyBatchesAsync(AsyncConnection connection,
java.util.List<? extends WriteRequest> writeRequests,
int batchNum,
SingleResultCallback<BulkWriteResult> callback) |
java.lang.Boolean |
getBypassDocumentValidation()
Gets the the bypass document level validation flag
|
private SingleResultCallback<BsonDocument> |
getCommandCallback(AsyncWriteBinding binding,
AsyncConnection connection,
BulkWriteBatch batch,
boolean retryWrites,
boolean canRetryIfError,
OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback) |
MongoNamespace |
getNamespace()
Gets the namespace of the collection to write to.
|
java.lang.Boolean |
getRetryWrites()
Returns true if writes should be retried if they fail due to a network error.
|
WriteConcern |
getWriteConcern()
Gets the write concern to apply
|
java.util.List<? extends WriteRequest> |
getWriteRequests()
Gets the list of write requests to execute.
|
boolean |
isOrdered()
Gets whether the writes are ordered.
|
private BulkWriteResult |
retryExecuteBatches(WriteBinding binding,
BulkWriteBatch retryBatch,
MongoException originalError) |
private void |
retryExecuteBatchesAsync(AsyncWriteBinding binding,
BulkWriteBatch retryBatch,
java.lang.Throwable originalError,
SingleResultCallback<BulkWriteResult> callback) |
private boolean |
shouldAcknowledge(BulkWriteBatch batch,
WriteConcern writeConcern) |
private void |
validateWriteRequestsAndReleaseConnectionIfError(Connection connection) |
private static final FieldNameValidator NO_OP_FIELD_NAME_VALIDATOR
private final MongoNamespace namespace
private final java.util.List<? extends WriteRequest> writeRequests
private final boolean ordered
private final boolean retryWrites
private final WriteConcern writeConcern
private java.lang.Boolean bypassDocumentValidation
@Deprecated public MixedBulkWriteOperation(MongoNamespace namespace, java.util.List<? extends WriteRequest> writeRequests, boolean ordered, WriteConcern writeConcern)
MixedBulkWriteOperation(MongoNamespace, List, boolean, WriteConcern, boolean)
insteadnamespace
- the database and collection namespace for the operation.writeRequests
- the list of writeRequests to execute.ordered
- whether the writeRequests must be executed in order.writeConcern
- the write concern for the operation.public MixedBulkWriteOperation(MongoNamespace namespace, java.util.List<? extends WriteRequest> writeRequests, boolean ordered, WriteConcern writeConcern, boolean retryWrites)
namespace
- the database and collection namespace for the operation.writeRequests
- the list of writeRequests to execute.ordered
- whether the writeRequests must be executed in order.writeConcern
- the write concern for the operation.retryWrites
- if writes should be retried if they fail due to a network error.public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
public boolean isOrdered()
public java.util.List<? extends WriteRequest> getWriteRequests()
public java.lang.Boolean getBypassDocumentValidation()
public MixedBulkWriteOperation bypassDocumentValidation(java.lang.Boolean bypassDocumentValidation)
bypassDocumentValidation
- If true, allows the write to opt-out of document level validation.public java.lang.Boolean getRetryWrites()
public BulkWriteResult execute(WriteBinding binding)
execute
in interface WriteOperation<BulkWriteResult>
binding
- the WriteBinding for the operationMongoBulkWriteException
- if a failure to complete the bulk write is detected based on the server responsepublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<BulkWriteResult> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<BulkWriteResult>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprivate BulkWriteResult executeBulkWriteBatch(WriteBinding binding, Connection connection, BulkWriteBatch originalBatch)
private BulkWriteResult retryExecuteBatches(WriteBinding binding, BulkWriteBatch retryBatch, MongoException originalError)
private BulkWriteResult executeLegacyBatches(Connection connection)
private void executeBatchesAsync(AsyncWriteBinding binding, AsyncConnection connection, BulkWriteBatch batch, boolean retryWrites, OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback)
private void retryExecuteBatchesAsync(AsyncWriteBinding binding, BulkWriteBatch retryBatch, java.lang.Throwable originalError, SingleResultCallback<BulkWriteResult> callback)
private void executeLegacyBatchesAsync(AsyncConnection connection, java.util.List<? extends WriteRequest> writeRequests, int batchNum, SingleResultCallback<BulkWriteResult> callback)
private BsonDocument executeCommand(Connection connection, BulkWriteBatch batch, WriteBinding binding)
private void executeCommandAsync(AsyncWriteBinding binding, AsyncConnection connection, BulkWriteBatch batch, OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback, SingleResultCallback<BsonDocument> commandCallback)
private boolean shouldAcknowledge(BulkWriteBatch batch, WriteConcern writeConcern)
private SingleResultCallback<BsonDocument> getCommandCallback(AsyncWriteBinding binding, AsyncConnection connection, BulkWriteBatch batch, boolean retryWrites, boolean canRetryIfError, OperationHelper.ConnectionReleasingWrappedCallback<BulkWriteResult> callback)
private void validateWriteRequestsAndReleaseConnectionIfError(Connection connection)