Skip to content

Commit 81b21a4

Browse files
committed
JAVA-787: Calling OutMessage.doneWithMessage in finally block of DBPort.findOne
1 parent 8453201 commit 81b21a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/com/mongodb/DBPort.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ synchronized CommandResult getLastError( DB db , WriteConcern concern ) throws I
158158

159159
synchronized private Response findOne( DB db , String coll , DBObject q ) throws IOException {
160160
OutMessage msg = OutMessage.query( db.getCollection(coll) , 0 , 0 , -1 , q , null );
161-
Response res = go( msg , db.getCollection( coll ) , null );
162-
return res;
161+
try {
162+
Response res = go( msg , db.getCollection( coll ) , null );
163+
return res;
164+
} finally {
165+
msg.doneWithMessage();
166+
}
163167
}
164168

165169
synchronized CommandResult runCommand( DB db , DBObject cmd ) throws IOException {

0 commit comments

Comments
 (0)