Modifier and Type | Class and Description |
---|---|
(package private) class |
CommandProtocol.CommandResultCallback |
Modifier and Type | Field and Description |
---|---|
private BsonDocument |
command |
private CommandListener |
commandListener |
private java.lang.String |
commandName |
private Decoder<T> |
commandResultDecoder |
private FieldNameValidator |
fieldNameValidator |
static Logger |
LOGGER |
private MongoNamespace |
namespace |
private static java.util.Set<java.lang.String> |
SECURITY_SENSITIVE_COMMANDS |
private boolean |
slaveOk |
Constructor and Description |
---|
CommandProtocol(java.lang.String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder) |
Modifier and Type | Method and Description |
---|---|
T |
execute(InternalConnection connection)
Execute the protocol.
|
void |
executeAsync(InternalConnection connection,
SingleResultCallback<T> callback)
Execute the protocol asynchronously.
|
private java.lang.String |
getCommandName() |
private static <D> D |
getResponseDocument(ResponseBuffers responseBuffers,
CommandMessage commandMessage,
Decoder<D> decoder) |
boolean |
isSlaveOk() |
private void |
sendFailedEvent(ConnectionDescription connectionDescription,
long startTimeNanos,
CommandMessage commandMessage,
java.lang.Throwable t) |
private void |
sendMessage(CommandMessage message,
InternalConnection connection) |
private void |
sendStartedEvent(InternalConnection connection,
ByteBufferBsonOutput bsonOutput,
CommandMessage message,
int documentPosition) |
private void |
sendSucceededEvent(ConnectionDescription connectionDescription,
long startTimeNanos,
CommandMessage commandMessage,
BsonDocument response) |
void |
setCommandListener(CommandListener commandListener) |
CommandProtocol<T> |
slaveOk(boolean slaveOk) |
public static final Logger LOGGER
private static final java.util.Set<java.lang.String> SECURITY_SENSITIVE_COMMANDS
private final MongoNamespace namespace
private final BsonDocument command
private final FieldNameValidator fieldNameValidator
private boolean slaveOk
private CommandListener commandListener
private volatile java.lang.String commandName
CommandProtocol(java.lang.String database, BsonDocument command, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
public boolean isSlaveOk()
public CommandProtocol<T> slaveOk(boolean slaveOk)
public T execute(InternalConnection connection)
Protocol
private static <D> D getResponseDocument(ResponseBuffers responseBuffers, CommandMessage commandMessage, Decoder<D> decoder)
public void executeAsync(InternalConnection connection, SingleResultCallback<T> callback)
Protocol
executeAsync
in interface Protocol<T>
connection
- the connection to execute the protocol oncallback
- the callback that is passed the result of the executionpublic void setCommandListener(CommandListener commandListener)
setCommandListener
in interface Protocol<T>
private java.lang.String getCommandName()
private void sendMessage(CommandMessage message, InternalConnection connection)
private void sendStartedEvent(InternalConnection connection, ByteBufferBsonOutput bsonOutput, CommandMessage message, int documentPosition)
private void sendSucceededEvent(ConnectionDescription connectionDescription, long startTimeNanos, CommandMessage commandMessage, BsonDocument response)
private void sendFailedEvent(ConnectionDescription connectionDescription, long startTimeNanos, CommandMessage commandMessage, java.lang.Throwable t)