private void incrementGenerationOnSocketException ( final InternalConnection connection , final Throwable t ) { if ( t instanceof MongoSocketException && ! ( t instanceof MongoSocketReadTimeoutException ) ) { if ( LOGGER . isWarnEnabled ( ) ) { LOGGER . warn ( format ( "Got socket exception on connection [%s] to %s. All connections to %s will be closed." , getId ( connection ) , serverId . getAddress ( ) , serverId . getAddress ( ) ) ) ; } invalidate ( ) ; } }
If there was a socket exception that wasn t some form of interrupted read increment the generation count so that any connections created prior will be discarded .