コード例 #1
0
 private void sendStartedEvent(
     final InternalConnection connection,
     final ByteBufferBsonOutput bsonOutput,
     final CommandMessage message,
     final int documentPosition) {
   if (commandListener != null) {
     ByteBufBsonDocument byteBufBsonDocument = createOne(bsonOutput, documentPosition);
     BsonDocument commandDocument;
     if (byteBufBsonDocument.containsKey("$query")) {
       commandDocument = byteBufBsonDocument.getDocument("$query");
       commandName = commandDocument.keySet().iterator().next();
     } else {
       commandDocument = byteBufBsonDocument;
       commandName = byteBufBsonDocument.getFirstKey();
     }
     BsonDocument commandDocumentForEvent =
         (SECURITY_SENSITIVE_COMMANDS.contains(commandName))
             ? new BsonDocument()
             : commandDocument;
     sendCommandStartedEvent(
         message,
         namespace.getDatabaseName(),
         commandName,
         commandDocumentForEvent,
         connection.getDescription(),
         commandListener);
   }
 }
コード例 #2
0
 private String getCommandName() {
   return commandName != null ? commandName : command.keySet().iterator().next();
 }