#NEWLINE# def _replace( self , connection ) : #NEWLINE# #INDENT# log . debug ( 'Replacing connection (%s) to %s' , id ( conn ) , self . host ) #NEWLINE# try : #NEWLINE# #INDENT# conn = self . _session . cluster . connection_factory ( self . host . address ) #NEWLINE# if self . _session . keyspace : #NEWLINE# #INDENT# conn . set_keyspace_blocking ( self . _session . keyspace ) #NEWLINE# #UNINDENT# self . _connection = conn #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# log . warning ( ( 'Failed reconnecting %s. Retrying.' % ( self . host . address , ) ) ) #NEWLINE# self . _session . submit ( self . _replace , connection ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# with self . _lock : #NEWLINE# #INDENT# self . _is_replacing = False #NEWLINE# self . _stream_available_condition . notify ( )