Reconnection to base if isn't used by persistent connection
358665
protected function safeDbReconnection(){
        if(empty(Yii::$app->db->pdo->getAttribute(constant("PDO::ATTR_PERSISTENT")))){
            Yii::$app->db->close();
            Yii::$app->db->open();
        }
    }
456961
def retry(self):
        """"""
        self.stream = None
        self.config.loop.call_later(RETRY_TIMER, self.start)
        _LOGGER.debug('Reconnecting to %s', self.config.host)
1281979
def _reconnect(self, errorState):
        
        def connect():
            if self.noisy:
                log.msg("Reconnecting now.")
            self.connect()

        backOff = self.backOffs[errorState]

        if self._errorState != errorState or self._delay is None:
            self._errorState = errorState
            self._delay = backOff['initial']
        else:
            self._delay = min(backOff['max'], self._delay * backOff['factor'])

        if self._delay == 0:
            connect()
        else:
            self._reconnectDelayedCall = self.reactor.callLater(self._delay,
                                                                connect)
            self._toState('waiting')
335664
@Override
    public synchronized boolean checkConnection(final boolean forceReconnect) {
        if (checkConnection(conn)) {
            return true;
        } else if (forceReconnect) {
            try {
                connect();
                recover();

                return true;
            } catch (final Exception ex) {
                logger.debug(dev, "reconnection failure", ex);
                return false;
            }
        }

        return false;
    }
723907
def reconnect(self, exc=None):
        """"""
        # Reset protocol binding before starting reconnect
        self.protocol = None

        if not self.closing:
            log.warning('disconnected from Rflink, reconnecting')
            self.loop.create_task(self.connect())
249815
synchronized boolean doReConnect() throws IOException {

        // In case we are still connected, test the connection and see if we can reuse it
        if(connectionManager.isConnected()) {
            try {
                final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();
                result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much
                return true;
            } catch (Exception e) {
                ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect");
            }
            // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect
            final Connection connection = connectionManager.getConnection();
            StreamUtils.safeClose(connection);
            if(connection != null) {
                try {
                    // Wait for the connection to be closed
                    connection.awaitClosed();
                } catch (InterruptedException e) {
                    throw new InterruptedIOException();
                }
            }
        }

        boolean ok = false;
        final Connection connection = connectionManager.connect();
        try {
            // Reconnect to the host-controller
            final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);
            try {
                boolean inSync = result.getResult().get();
                ok = true;
                reconnectRunner = null;
                return inSync;
            } catch (ExecutionException e) {
                throw new IOException(e);
            } catch (InterruptedException e) {
                throw new InterruptedIOException();
            }
        } finally {
            if(!ok) {
                StreamUtils.safeClose(connection);
            }
        }
    }
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)
818383
def _reconnect(self):
        """"""
        self._wrapped = self._client.read_rows(
            _copy_stream_position(self._position), **self._read_rows_kwargs
        )
822859
private void reconnect(Exception reconnectEx) {
        // Log the exception as a warning.
        m_logger.warn("Reconnecting to Cassandra due to error", reconnectEx);
        
        // Reconnect up to the configured number of times, waiting a little between each attempt.
        boolean bSuccess = false;
        for (int attempt = 1; !bSuccess; attempt++) {
            try {
                close();
                m_dbService.connectDBConn(this);
                m_logger.debug("Reconnect successful");
                bSuccess = true;
            } catch (Exception ex) {
                // Abort if all retries failed.
                if (attempt >= m_max_reconnect_attempts) {
                    m_logger.error("All reconnect attempts failed; abandoning reconnect", ex);
                    throw new DBNotAvailableException("All reconnect attempts failed", ex);
                }
                m_logger.warn("Reconnect attempt #" + attempt + " failed", ex);
                try {
                    Thread.sleep(m_retry_wait_millis * attempt);
                } catch (InterruptedException e) {
                    // Ignore
                }
            }
        }
    }
1354616
function reconnect() {
  client.end(false, function () {
    console.log('Reconnecting client: ' + clientId);
    client.connect(url, { 'clientId': clientId });
  });
}
1202956
private void checkPotentiallyTimedOutConnection() {
    boolean stillCheckingTimeouts = true;
    while (stillCheckingTimeouts) {
      try {
        for (SelectionKey sk : selector.keys()) {
          MemcachedNode mn = (MemcachedNode) sk.attachment();
          if (mn.getContinuousTimeout() > timeoutExceptionThreshold) {
            getLogger().warn("%s exceeded continuous timeout threshold", sk);
            lostConnection(mn);
          }
        }
        stillCheckingTimeouts = false;
      } catch(ConcurrentModificationException e) {
        getLogger().warn("Retrying selector keys after "
          + "ConcurrentModificationException caught", e);
        continue;
      }
    }
  }
310867
function ReconnectingConnection(id, connection) {
  this.id = id;
  this.connection = null;
  this.closed = false;
  this.queue = [];

  this.setConnection(connection);
}
764710
public function reconnect()
    {
        if (is_callable($this->reconnector)) {
            $this->doctrineConnection = null;

            return call_user_func($this->reconnector, $this);
        }

        throw new LogicException('Lost connection and no reconnector available.');
    }
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()
3721
private function reconnect()
    {
        $auto = $this->_auto_reconnect;
        $this->disconnect();
        $this->auto_reconnect = $auto;
        $this->connect();
    }
1013873
def reconnect
      unless @reconnecting
        @reconnecting = true
        @stats["reconnects"].update("initiate")
        @reconnect_timer = EM_S::PeriodicTimer.new(rand(HEALTH_CHECK_INTERVAL)) do
          begin
            @http_client.check_health
            @stats["reconnects"].update("success")
            @reconnect_timer.cancel if @reconnect_timer # only need 'if' for test purposes
            @reconnect_timer = @reconnecting = nil
            renew_authorization(0)
          rescue BalancedHttpClient::NotResponding => e
            @stats["reconnects"].update("no response")
          rescue Exception => e
            ErrorTracker.log(self, "Failed authorization reconnect", e)
            @stats["reconnects"].update("failure")
          end
          @reconnect_timer.interval = HEALTH_CHECK_INTERVAL if @reconnect_timer
        end
      end
      true
    end
1156602
function(client, window, reconnectInterval) { 
		this._client = client;        	
		this._window = window;
		this._reconnectInterval = reconnectInterval*1000;
		
		var doTimeout = function (reconnector) {
			return function () {
				return doReconnect.apply(reconnector);
			};
		};
		
		/** @ignore */
		var doReconnect = function() { 
			if (this._client.connected) {
				this._client._trace("Reconnector.doReconnect", "ALREADY CONNECTED");
				this._window.clearTimeout(this.reconnectorTimer);
			} else {
				this._client._trace("Reconnector.doReconnect", "reconnecting");
				if (this._client.connectOptions.uris) {
					this._client.hostIndex = 0;
					this._client._doConnect(this._client.connectOptions.uris[0]);  
				} else {
					this._client._doConnect(this._client.uri);
				}
				this.reconnectorTimer = this._window.setTimeout(doTimeout(this), this._reconnectInterval);
			}
		}
		
		this.reset = function() {
			this._window.clearTimeout(this.reconnectorTimer);
			this.reconnectorTimer = this._window.setTimeout(doTimeout(this), this._reconnectInterval);
		}

		this.cancel = function() {
			this._window.clearTimeout(this.reconnectorTimer);
		}
	 }