Called when the connection to the broker has been lost.

        See the documentation of
        `twisted.internet.protocol.ReconnectingClientFactory` for details.
552376
def clientConnectionLost(self, connector, reason):
        
        if not isinstance(reason.value, error.ConnectionDone):
            _legacy_twisted_log.msg(
                "Lost connection to the AMQP broker ({reason})",
                reason=reason.value,
                logLevel=logging.WARNING,
            )
        if self._client_ready.called:
            # Renew the ready deferred, it will callback when the
            # next connection is ready.
            self._client_ready = defer.Deferred()
        protocol.ReconnectingClientFactory.clientConnectionLost(self, connector, reason)
901518
def connection_lost(self, exc=None):
        
        if self._loop.get_debug():
            self.producer.logger.debug('connection lost %s', self)
        self.event('connection_lost').fire(exc=exc)
776270
private synchronized void reconnect() {
        XMPPConnection connection = this.weakRefConnection.get();
        if (connection == null) {
            LOGGER.fine("Connection is null, will not reconnect");
            return;
        }
        // Since there is no thread running, creates a new one to attempt
        // the reconnection.
        // avoid to run duplicated reconnectionThread -- fd: 16/09/2010
        if (reconnectionThread != null && reconnectionThread.isAlive())
            return;

        reconnectionThread = Async.go(reconnectionRunnable,
                        "Smack Reconnection Manager (" + connection.getConnectionCounter() + ')');
    }
1130137
public void reconnect() throws SQLException {
    try {
      listener.reconnect();
    } catch (SQLException e) {
      ExceptionMapper.throwException(e, null, null);
    }
  }
592521
def on_receive(self, broker):
        """"""
        _vv and IOLOG.debug('%r.on_receive()', self)

        buf = self.receive_side.read()
        if not buf:
            return self.on_disconnect(broker)

        self._internal_receive(broker, buf)
661423
public void reconnect() throws SQLException {
    boolean inTransaction = currentProtocol != null && currentProtocol.inTransaction();
    reconnectFailedConnection(new SearchFilter(true, false));
    handleFailLoop();
    if (inTransaction) {
      throw new ReconnectDuringTransactionException(
          "Connection reconnect automatically during an active transaction", 1401, "25S03");
    }
  }
629289
def reconnect(self):
		""""""
		self.lock.acquire()
		if self.use_ssl:
			self.client = http.client.HTTPSConnection(self.host, self.port, context=self.ssl_context)
		else:
			self.client = http.client.HTTPConnection(self.host, self.port)
		self.lock.release()
148928
def on_api_socket_reconnected(self):
        """"""
        self.__is_acc_sub_push = False
        self.__last_acc_list = []

        ret, msg = RET_OK, ''
        # auto unlock trade
        if self._ctx_unlock is not None:
            password, password_md5 = self._ctx_unlock
            ret, data = self.unlock_trade(password, password_md5)
            logger.debug('auto unlock trade ret={},data={}'.format(ret, data))
            if ret != RET_OK:
                msg = data

        # 定阅交易帐号推送
        if ret == RET_OK:
            self.__check_acc_sub_push()

        return ret, msg
587178
def stopFactory(self):
        
        if self._client:
            yield self._client.halt()
        protocol.ReconnectingClientFactory.stopFactory(self)
708982
def _recover_network_failure(self):
        """"""
        if self.auto_reconnect and not self._is_closing:
            connected = False
            while not connected:
                log_msg = "* ATTEMPTING RECONNECT"
                if self._retry_new_version:
                    log_msg = "* RETRYING DIFFERENT DDP VERSION"
                self.ddpsocket._debug_log(log_msg)
                time.sleep(self.auto_reconnect_timeout)
                self._init_socket()
                try:
                    self.connect()
                    connected = True
                    if self._retry_new_version:
                        self._retry_new_version = False
                    else:
                        self._is_reconnecting = True
                except (socket.error, WebSocketException):
                    pass
9652
def connection_lost(self, exc):
        """"""
        if exc:
            log.exception('disconnected due to exception')
        else:
            log.info('disconnected because of close/abort.')
        if self.disconnect_callback:
            self.disconnect_callback(exc)
1054913
def reconnect(self):
        '''
        '''
        if self._connection.closed():
            self._connection.reset()

            yield from self._connection.connect()
308142
protected void connectionClosed(IoSession session) {
		this.connected = false;
		this._disconnect();
		log.info("Connection lost to aggregator at {}:{}", this.host,
				Integer.valueOf(this.port));

		while (this.stayConnected) {
			try {
				Thread.sleep(this.connectionRetryDelay);
			} catch (InterruptedException ie) {
				// Ignored
			}
			log.warn("Reconnecting to aggregator at {}:{}", this.host,
					Integer.valueOf(this.port));
			if (this.connect(this.connectionTimeout)) {
				return;
			}
			log.warn("Failed to reconnect to aggregator at {}:{}", this.host,
					Integer.valueOf(this.port));

		}
		this.finishConnection();

	}
60017
def close(self):
        

        def validate_client(client):
            """
            Validate that the connection is for the current client
            :param client:
            :return:
            """
            host, port = client.addr
            parsed_url = urlparse(self._hostname)
            return host == parsed_url.hostname and port == parsed_url.port

        # read https://github.com/twisted/treq/issues/86
        # to understand the following...
        def _check_fds(_):
            fds = set(reactor.getReaders() + reactor.getReaders())
            if not [fd for fd in fds if isinstance(fd, Client) and validate_client(fd)]:
                return

            return deferLater(reactor, 0, _check_fds, None)

        pool = self._async_http_client_params["pool"]
        return pool.closeCachedConnections().addBoth(_check_fds)
936967
def reconnect(self):
        
        connect_attempt = 0
        max_retries = self.config['max_reconnect_retries']
        logging.info('attempting to reconnect to crossbar')
        runner = self.setup_runner()
        while True:

            if connect_attempt == max_retries:
                logging.info('max retries reached; stopping service')
                sys.exit(1)
            self.check_event_loop()

            try:
                logging.info('waiting 5 seconds')
                time.sleep(5)
                if self.check_transport_host():
                    logging.info('waiting 10 seconds to ensure that crossbar has initialized before reconnecting')
                    time.sleep(10)
                    runner.run(Component)
                else:
                    logging.error('crossbar host port 8080 not available...')
            except RuntimeError as error:
                logging.error(error)
            except ConnectionRefusedError as error:
                logging.error(error)
            except ConnectionError as error:
                logging.error(error)
            except KeyboardInterrupt:
                logging.info('User initiated shutdown')
                loop = asyncio.get_event_loop()
                loop.stop()
                sys.exit(1)
            connect_attempt += 1
46273
private void onConnectionClosed()
   {
      ConnectionEvent evt = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
      for (ConnectionEventListener listener : listeners)
      {
         try
         {
            listener.connectionClosed(evt);
         }
         catch (Exception e1)
         {
            LOG.warn("An error occurs while notifying the listener " + listener, e1);
         }
      }
   }
247642
def reinit(self):
        
        log.debug("Reinitializing socket connection for %s:%d" % (self.host, self.port))

        if self._sock:
            self.close()

        try:
            self._sock = socket.create_connection((self.host, self.port), self.timeout)
        except socket.error:
            log.exception('Unable to connect to kafka broker at %s:%d' % (self.host, self.port))
            self._raise_connection_error()