class InsertProtocol extends WriteProtocol
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<InsertRequest> |
insertRequestList |
private static Logger |
LOGGER |
| Constructor and Description |
|---|
InsertProtocol(MongoNamespace namespace,
boolean ordered,
WriteConcern writeConcern,
java.util.List<InsertRequest> insertRequestList)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendToWriteCommandResponseDocument(RequestMessage curMessage,
RequestMessage nextMessage,
WriteConcernResult writeConcernResult,
BsonDocument response) |
protected RequestMessage |
createRequestMessage(MessageSettings settings)
Create the initial request message for the write.
|
WriteConcernResult |
execute(InternalConnection connection)
Execute the protocol.
|
void |
executeAsync(InternalConnection connection,
SingleResultCallback<WriteConcernResult> callback)
Execute the protocol asynchronously.
|
protected BsonDocument |
getAsWriteCommand(ByteBufferBsonOutput bsonOutput,
int firstDocumentPosition) |
protected Logger |
getLogger()
Gets the logger.
|
getBaseCommandDocument, getCommandName, getNamespace, getWriteConcern, isOrdered, setCommandListenerprivate static final Logger LOGGER
private final java.util.List<InsertRequest> insertRequestList
public InsertProtocol(MongoNamespace namespace, boolean ordered, WriteConcern writeConcern, java.util.List<InsertRequest> insertRequestList)
namespace - the namespaceordered - whether the inserts are orderedwriteConcern - the write concerninsertRequestList - the list of documents to insertpublic WriteConcernResult execute(InternalConnection connection)
Protocolexecute in interface Protocol<WriteConcernResult>execute in class WriteProtocolconnection - the connection to execute the protocol onpublic void executeAsync(InternalConnection connection, SingleResultCallback<WriteConcernResult> callback)
ProtocolexecuteAsync in interface Protocol<WriteConcernResult>executeAsync in class WriteProtocolconnection - the connection to execute the protocol oncallback - the callback that is passed the result of the executionprotected BsonDocument getAsWriteCommand(ByteBufferBsonOutput bsonOutput, int firstDocumentPosition)
getAsWriteCommand in class WriteProtocolprotected RequestMessage createRequestMessage(MessageSettings settings)
WriteProtocolcreateRequestMessage in class WriteProtocolsettings - the message settingsprotected void appendToWriteCommandResponseDocument(RequestMessage curMessage, RequestMessage nextMessage, WriteConcernResult writeConcernResult, BsonDocument response)
appendToWriteCommandResponseDocument in class WriteProtocolprotected Logger getLogger()
WriteProtocolgetLogger in class WriteProtocol