Starts a reconnection mechanism if it was configured to do that.
The algorithm is been executed when the first connection error is detected.
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() + ')');
    }
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
                }
            }
        }
    }
829384
public void reConnect() throws IOException {
	try {
	    if (client != null && client.isConnected()) client.disconnect();
	}
	catch (IOException ioe) {}
	connect();
    }
126189
public void     start(boolean buildInitial) throws Exception
    {
        Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");

        client.getConnectionStateListenable().addListener(connectionStateListener);

        if ( buildInitial )
        {
            client.checkExists().creatingParentContainersIfNeeded().forPath(path);
            internalRebuild();
        }
        reset();
    }
397488
def _reconnect(self):
        
        if self.idle or self.closed:
            LOGGER.debug('Attempting RabbitMQ reconnect in %s seconds',
                         self.reconnect_delay)
            self.io_loop.call_later(self.reconnect_delay, self.connect)
            return
        LOGGER.warning('Reconnect called while %s', self.state_description)
246017
public void start()
    {
        Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Already started");

        client.getConnectionStateListenable().addListener(connectionStateListener);
        createNode();
    }
1024018
function () {
        reconnectStartedAt = null;
        isConnecting = false;
        if (ortc.sockjs && ortc.sockjs != null) {
            ortc.sockjs.close();
            ortc.sockjs = null;
        }
    }
1320090
public function reconnect()
    {
        if ($this->client->isConnected()) {
            $this->client->disconnect();
        }
        $this->client->connect();
    }
419029
private void executeReconnect() throws InterruptedException {
		// Close connection
		websocketEndpoint.close();

		// Store the reconnect time to prevent to much
		// reconnects in a short timeframe. Otherwise the
		// rate limit will apply and the reconnects are not successfully
		logger.info("Wait for next reconnect timeslot");
		eventsInTimeslotManager.recordNewEvent();
		eventsInTimeslotManager.waitForNewTimeslot();
		logger.info("Wait for next reconnect timeslot DONE");

		bitfinexApiBroker.reconnect();
	}
110483
def run(self):
        

        while self.__nice_quit_ev.is_set() is False:
            self.__connect()

        _logger.info("Connection re-connect loop has terminated: %s", self.__mc)
600833
def start(io_loop=None, check_time=2):

    
    io_loop = io_loop or asyncio.get_event_loop()
    if io_loop in _io_loops:
        return
    _io_loops[io_loop] = True
    if len(_io_loops) > 1:
        logger.warning("aiohttp_autoreload started more than once in the same process")
    # if _has_execv:
    #     add_reload_hook(functools.partial(io_loop.close, all_fds=True))
    modify_times = {}
    callback = functools.partial(_reload_on_update, modify_times)
    logger.debug("Starting periodic checks for code changes")
    call_periodic(check_time, callback, loop=io_loop)
542060
void start(Handler<ConnectionOutputBatch> startHandler) {
    connection.doBatchStart(id, args);
    this.startHandler = startHandler;
  }
832333
public synchronized void reconnect() {

        LOGGER.info("start to reconnect....");

        int retries = 0;
        while (true) {

            try {

                if (!zk.getState().equals(States.CLOSED)) {
                    break;
                }

                LOGGER.warn("zookeeper lost connection, reconnect");

                close();

                connect(internalHost);

            } catch (Exception e) {

                LOGGER.error(retries + "\t" + e.toString());

                // sleep then retry
                try {
                    int sec = ResilientActiveKeyValueStore.RETRY_PERIOD_SECONDS;
                    LOGGER.warn("sleep " + sec);
                    TimeUnit.SECONDS.sleep(sec);
                } catch (InterruptedException e1) {
                }
            }
        }
    }
600933
public void start() {
		checkState(!closed, "The RPC connection is already closed");
		checkState(!isConnected() && pendingRegistration == null, "The RPC connection is already started");

		final RetryingRegistration<F, G, S> newRegistration = createNewRegistration();

		if (REGISTRATION_UPDATER.compareAndSet(this, null, newRegistration)) {
			newRegistration.startRegistration();
		} else {
			// concurrent start operation
			newRegistration.cancel();
		}
	}
434126
private void autoStartConsumer() throws JMSException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "autoStartConsumer", new Object[] { autoStart, jmsConnection.getState() });

        try {
            //check if autoStart is true and connection is not started.
            //If its already started, it implies the first consumer has already started the connection
            if (autoStart && (jmsConnection.getState() == JmsInternalConstants.STOPPED)) {
                // start the connection
                jmsConnection.start();
            }
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "autoStartConsumer");
        }
    }
1130137
public void reconnect() throws SQLException {
    try {
      listener.reconnect();
    } catch (SQLException e) {
      ExceptionMapper.throwException(e, null, null);
    }
  }
1335845
function autoReconnect(options, connectionListener)
{
	var reconnectInterval = getOption(options, 'reconnectInterval', 5000);

	var reconnector = new events.EventEmitter();

	function reconnect()
	{
		var client = connect(options);
		var isReconnecting = false;
		
		function tryReconnecting()
		{
			if ( !isReconnecting )
			{
				isReconnecting = true;
				reconnector.emit('close');
			}
		}

		client.on('connect', () => {
			connectionListener(client);
		});

		client.on('close', () => {
			tryReconnecting();
		});

		client.on('error', (e) => {
			tryReconnecting();
		});
	}

	reconnector.on('close', () => {
		setTimeout(() => reconnector.emit('reconnect'), reconnectInterval);
	});

	reconnector.on('reconnect', () => {
		reconnect();
	});
	
	reconnect();
}