public class BulkWriteBatchCombiner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
deletedCount |
private int |
insertedCount |
private int |
matchedCount |
private java.lang.Integer |
modifiedCount |
private boolean |
ordered |
private ServerAddress |
serverAddress |
private WriteConcern |
writeConcern |
private java.util.List<WriteConcernError> |
writeConcernErrors |
private java.util.Set<BulkWriteError> |
writeErrors |
private java.util.Set<BulkWriteUpsert> |
writeUpserts |
Constructor and Description |
---|
BulkWriteBatchCombiner(ServerAddress serverAddress,
boolean ordered,
WriteConcern writeConcern)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorResult(java.util.List<BulkWriteError> writeErrors,
WriteConcernError writeConcernError,
IndexMap indexMap)
Add a list of error results and a write concern error
|
void |
addErrorResult(MongoBulkWriteException exception,
IndexMap indexMap)
Add an error result
|
void |
addResult(BulkWriteResult result,
IndexMap indexMap)
Add a result
|
void |
addWriteConcernErrorResult(WriteConcernError writeConcernError)
Add a write concern error result
|
void |
addWriteErrorResult(BulkWriteError writeError,
IndexMap indexMap)
Add a write error result
|
private BulkWriteResult |
createResult() |
MongoBulkWriteException |
getError()
Gets the combined errors as an exception
|
BulkWriteResult |
getResult()
Gets the combined result.
|
boolean |
hasErrors()
Gets whether there are errors in the combined result.
|
private boolean |
hasWriteConcernErrors() |
private boolean |
hasWriteErrors() |
private void |
mergeUpserts(java.util.List<BulkWriteUpsert> upserts,
IndexMap indexMap) |
private void |
mergeWriteConcernError(WriteConcernError writeConcernError) |
private void |
mergeWriteErrors(java.util.List<BulkWriteError> newWriteErrors,
IndexMap indexMap) |
boolean |
shouldStopSendingMoreBatches()
True if ordered and has write errors.
|
private void |
throwOnError() |
private final ServerAddress serverAddress
private final boolean ordered
private final WriteConcern writeConcern
private int insertedCount
private int matchedCount
private int deletedCount
private java.lang.Integer modifiedCount
private final java.util.Set<BulkWriteUpsert> writeUpserts
private final java.util.Set<BulkWriteError> writeErrors
private final java.util.List<WriteConcernError> writeConcernErrors
public BulkWriteBatchCombiner(ServerAddress serverAddress, boolean ordered, WriteConcern writeConcern)
serverAddress
- the server addressordered
- orderedwriteConcern
- the write concernpublic void addResult(BulkWriteResult result, IndexMap indexMap)
result
- the resultindexMap
- the index mappublic void addErrorResult(MongoBulkWriteException exception, IndexMap indexMap)
exception
- the exceptionindexMap
- the index mappublic void addWriteErrorResult(BulkWriteError writeError, IndexMap indexMap)
writeError
- the write errorindexMap
- the index mappublic void addWriteConcernErrorResult(WriteConcernError writeConcernError)
writeConcernError
- the write concern errorpublic void addErrorResult(java.util.List<BulkWriteError> writeErrors, WriteConcernError writeConcernError, IndexMap indexMap)
writeErrors
- the errorswriteConcernError
- the write concern errorindexMap
- the index mappublic BulkWriteResult getResult()
public boolean shouldStopSendingMoreBatches()
public boolean hasErrors()
public MongoBulkWriteException getError()
private void mergeWriteConcernError(WriteConcernError writeConcernError)
private void mergeWriteErrors(java.util.List<BulkWriteError> newWriteErrors, IndexMap indexMap)
private void mergeUpserts(java.util.List<BulkWriteUpsert> upserts, IndexMap indexMap)
private void throwOnError()
private BulkWriteResult createResult()
private boolean hasWriteErrors()
private boolean hasWriteConcernErrors()