Skip to content

Commit 8eaa84a

Browse files
committed
JAVA-335: all connections to a server should get closed under certain types of exception
1 parent 9845e4a commit 8eaa84a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/com/mongodb/DBPortPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ void gotError( Exception e ){
187187
return;
188188
}
189189

190-
if ( e instanceof java.net.SocketTimeoutException && _options.socketTimeout > 0 ){
191-
// we don't want to clear the port pool for 1 connection timing out
190+
if ( e instanceof java.net.SocketTimeoutException ){
191+
// we don't want to clear the port pool for a connection timing out
192192
return;
193193
}
194-
Bytes.LOGGER.log( Level.INFO , "emptying DBPortPool b/c of error" , e );
194+
Bytes.LOGGER.log( Level.WARNING , "emptying DBPortPool to " + getServerAddress() + " b/c of error" , e );
195195

196196
// force close all sockets
197197

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ void error( DBPort p , Exception e ){
349349
p.close();
350350
_requestPort = null;
351351
// _logger.log( Level.SEVERE , "MyPort.error called" , e );
352+
353+
// depending on type of error, may need to close other connections in pool
354+
p.getPool().gotError(e);
352355
}
353356

354357
void requestEnsureConnection(){

0 commit comments

Comments
 (0)