Skip to content

Commit

Permalink
JAVA-335: all connections to a server should get closed under certain…
Browse files Browse the repository at this point in the history
… types of exception
  • Loading branch information
agirbal committed May 27, 2011
1 parent 9845e4a commit 8eaa84a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/com/mongodb/DBPortPool.java
Expand Up @@ -187,11 +187,11 @@ void gotError( Exception e ){
return;
}

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

// force close all sockets

Expand Down
3 changes: 3 additions & 0 deletions src/main/com/mongodb/DBTCPConnector.java
Expand Up @@ -349,6 +349,9 @@ void error( DBPort p , Exception e ){
p.close();
_requestPort = null;
// _logger.log( Level.SEVERE , "MyPort.error called" , e );

// depending on type of error, may need to close other connections in pool
p.getPool().gotError(e);
}

void requestEnsureConnection(){
Expand Down

0 comments on commit 8eaa84a

Please sign in to comment.