Skip to content

Commit f71837e

Browse files
committed
JAVA-652: Synchronizing on correct object in close method
1 parent f4f0b84 commit f71837e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/main/com/mongodb/util/SimplePool.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,12 @@ private boolean permitAcquired(final long waitTime) throws InterruptedException
155155
}
156156

157157
/** Clears the pool of all objects. */
158-
protected void close(){
159-
synchronized( _avail ){
160-
_closed = true;
161-
for ( T t : _avail )
162-
cleanup( t );
163-
_avail.clear();
164-
_out.clear();
165-
}
158+
protected synchronized void close(){
159+
_closed = true;
160+
for (T t : _avail)
161+
cleanup(t);
162+
_avail.clear();
163+
_out.clear();
166164
}
167165

168166
public String getName() {

0 commit comments

Comments
 (0)