Skip to content

Commit fe6b133

Browse files
committed
JAVA-351: do not retry reads if exception is SocketTimeoutException
1 parent 7aae216 commit fe6b133

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package com.mongodb;
2020

2121
import java.io.IOException;
22+
import java.net.SocketTimeoutException;
2223
import java.util.*;
2324
import java.util.logging.Level;
2425
import java.util.logging.Logger;
@@ -204,7 +205,8 @@ public Response call( DB db , DBCollection coll , OutMessage m , ServerAddress h
204205
}
205206
catch ( IOException ioe ){
206207
mp.error( port , ioe );
207-
retry = _error( ioe, slaveOk ) && ! coll._name.equals( "$cmd" ) && retries > 0;
208+
retry = retries > 0 && !coll._name.equals( "$cmd" )
209+
&& !(ioe instanceof SocketTimeoutException) && _error( ioe, slaveOk );
208210
if ( !retry ){
209211
throw new MongoException.Network( "can't call something" , ioe );
210212
}

0 commit comments

Comments
 (0)