Skip to content

Commit 612b71b

Browse files
committed
JAVA-1220: Avoid turning the active query into a string unless it's needed.
1 parent 784e1fd commit 612b71b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/com/mongodb/DBPort.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ class ActiveState {
424424
ActiveState(final OutMessage outMessage) {
425425
namespace = outMessage.getNamespace();
426426
opCode = outMessage.getOpCode();
427-
query = outMessage.getQuery() != null ? outMessage.getQuery().toString() : null;
427+
query = outMessage.getQuery();
428428
numDocuments = outMessage.getNumDocuments();
429429
this.startTime = System.nanoTime();
430430
this.threadName = Thread.currentThread().getName();
@@ -438,7 +438,7 @@ OutMessage.OpCode getOpCode() {
438438
return opCode;
439439
}
440440

441-
String getQuery() {
441+
DBObject getQuery() {
442442
return query;
443443
}
444444

@@ -456,7 +456,7 @@ String getThreadName() {
456456

457457
private final String namespace;
458458
private final OutMessage.OpCode opCode;
459-
private final String query;
459+
private final DBObject query;
460460
private int numDocuments;
461461
private final long startTime;
462462
private final String threadName;

src/main/com/mongodb/InUseConnectionBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class InUseConnectionBean {
4141
durationMS = TimeUnit.NANOSECONDS.toMillis(currentNanoTime - activeState.getStartTime());
4242
namespace = activeState.getNamespace();
4343
opCode = activeState.getOpCode();
44-
query = activeState.getQuery();
44+
query = activeState.getQuery().toString();
4545
threadName = activeState.getThreadName();
4646
numDocuments = activeState.getNumDocuments();
4747
}

0 commit comments

Comments
 (0)