Skip to content

Commit 9984d4e

Browse files
committed
some port fixes
1 parent eb208c7 commit 9984d4e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/main/com/mongodb/DBPortPool.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ protected long memSize( DBPort p ){
9191

9292
public DBPort get(){
9393
DBPort port = null;
94-
9594
if ( ! _waitingSem.tryAcquire() )
9695
throw new NoMoreConnection();
9796

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public Response call( DB db , DBCollection coll , OutMessage m , int retries )
174174

175175
try {
176176
Response res = port.call( m , coll );
177+
mp.done( port );
177178
ServerError err = res.getError();
178179

179180
if ( err != null && err.isNotMasterError() ){
@@ -242,12 +243,18 @@ DBPort get( boolean keep ){
242243
if ( _port != null )
243244
return _port;
244245

245-
DBPort p = _curPortPool.get();
246-
if ( keep && _inRequest )
247-
_port = p;
248-
249-
_last = p;
250-
return p;
246+
try {
247+
DBPort p = _curPortPool.get();
248+
if ( keep && _inRequest )
249+
_port = p;
250+
251+
_last = p;
252+
return p;
253+
}
254+
catch ( DBPortPool.NoMoreConnection nmc ){
255+
_internalStack = 0;
256+
throw nmc;
257+
}
251258
}
252259

253260
void done( DBPort p ){

0 commit comments

Comments
 (0)