iterates thru the list of established connections and resets them by disconnecting and reconnecting
770755
def reset_all(self, suppress_logging=False):
        
        pool_names = list(self.pools)
        for name in pool_names:
            self.reset(name, suppress_logging)
1306202
private static synchronized void closeRegisteredConnections() {
        for (Connection connection : activeConnections) {
            LOGGER.log(Level.INFO, "Forcing connection to {0}:{1} closed.",
                    new Object[]{connection.getHostname(), connection.getPort()});
            // force closed just in case
            connection.close();
        }
        activeConnections.clear();
    }
707237
def reset(self):
        
        for proxy in list(self.dead):
            self.dead.remove(proxy)
            self.unchecked.add(proxy)
1149425
def clear(self):
        
        self._closed = False
        self._ready.clear()
        self._connection.clear()
        self.http.recreate()
40386
def reset(self):
        
        # Session IDs can be random on every connection
        self.id = struct.unpack('q', os.urandom(8))[0]
        self._sequence = 0
        self._last_msg_id = 0
240711
private static void resetHostList(AuroraListener listener, Deque<HostAddress> loopAddresses) {
    //if all servers have been connected without result
    //add back all servers
    List<HostAddress> servers = new ArrayList<>();
    servers.addAll(listener.getUrlParser().getHostAddresses());

    Collections.shuffle(servers);

    //if cluster host is set, add it to the end of the list
    if (listener.getClusterHostAddress() != null
        && listener.getUrlParser().getHostAddresses().size() < 2) {
      servers.add(listener.getClusterHostAddress());
    }

    //remove current connected hosts to avoid reconnect them
    servers.removeAll(listener.connectedHosts());

    loopAddresses.clear();
    loopAddresses.addAll(servers);
  }
316846
def purge(self, name=None):
        
        self.disconnect(name)

        if name in self._connections:
            del self._connections[name]
1024018
function () {
        reconnectStartedAt = null;
        isConnecting = false;
        if (ortc.sockjs && ortc.sockjs != null) {
            ortc.sockjs.close();
            ortc.sockjs = null;
        }
    }
951698
def reconnect_all(self):
        
        for role in self.Instances.keys():
            for connection in self.Instances[role]:
                connection.reconnect()
1094483
def reconnect(self):
        """"""
        try:
            self.conn.close()
        except Exception,e:
            self.logger.warn(e)

        self.createConnection()

        return True
1062945
def reset(self):
        
        self.connection.rebuild_index(
            self.index, coll_name=self.target_coll_name)
704609
protected synchronized void reset(Connection connection,
                        ReceiveListener listener,
                        WsByteBuffer data,
                        int size,
                        int segmentType,
                        int requestNumber,
                        int priority,
                        boolean allocatedFromPool,
                        boolean partOfExchange,
                        Conversation conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset",
                                           new Object[]
                                           {
                                              connection,
                                              listener,
                                              data,
                                              ""+size,
                                              ""+segmentType,
                                              ""+requestNumber,
                                              ""+priority,
                                              ""+allocatedFromPool,
                                              ""+partOfExchange,
                                              conversation
                                           });

      this.connection = connection;
      this.listener = listener;
      this.data = data;
      this.size = size;
      this.segmentType = segmentType;
      this.requestNumber = requestNumber;
      this.priority = priority;
      this.allocatedFromPool = allocatedFromPool;
      this.partOfExchange = partOfExchange;
      this.conversation = conversation;
      setDispatchable(null);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset");
   }
506312
def shutdown_connections(self):
        """"""
        if not self.is_shutting_down:
            self.set_state(self.STATE_SHUTTING_DOWN)
        for name in self.connections:
            if self.connections[name].is_running:
                self.connections[name].shutdown()
847503
async def _reconnect(self):
        

        # 1. Close all transactions
        for msg_class in self._transactions:
            _1, _2, _3, coroutine_abrt, _4 = self._msgs_registered[msg_class]
            if coroutine_abrt is not None:
                for key in self._transactions[msg_class]:
                    for args, kwargs in self._transactions[msg_class][key]:
                        self._loop.create_task(coroutine_abrt(key, *args, **kwargs))
            self._transactions[msg_class] = {}

        # 2. Call on_disconnect
        await self._on_disconnect()

        # 3. Stop tasks
        for task in self._restartable_tasks:
            task.cancel()
        self._restartable_tasks = []

        # 4. Restart socket
        self._socket.disconnect(self._router_addr)

        # 5. Re-do start sequence
        await self.client_start()
591143
private void reclaimConnections() {

        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "reclaimConnections");
        }
        if (totalConnectionCount.get() == 0) {
            /*
             * If there are no connection, we have nothing to reclaim
             */
            if (tc.isEntryEnabled()) {
                Tr.exit(this, tc, "reclaimConnections", "Total connection count is zero");
            }
            return;
        }

        // This is only used for debug information
        int totalNumberOfConnectionRemoved = 0;

        /*
         * Look through the free pools for expired Aged and UnusedTimeout values
         */
        for (int j = 0; j < maxFreePoolHashSize; ++j) {
            synchronized (freePool[j].freeConnectionLockObject) {
                boolean removemcw = false;
                int mcwlSize = freePool[j].mcWrapperList.size();
                for (int k = 0; k < mcwlSize; ++k) {
                    MCWrapper mcw = (MCWrapper) freePool[j].mcWrapperList.get(k);
                    if (!removemcw && agedTimeout != -1) {
                        if (mcw.hasAgedTimedOut(agedTimeoutMillis)) {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "Aged timeout reclaim connection " + mcw);
                            }
                            removemcw = true;
                        }
                    }
                    if (!removemcw && unusedTimeout != -1) {
                        if (mcw.hasIdleTimedOut(unusedTimeout * 1000)
                            && (this.totalConnectionCount.get() > minConnections)) {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "Unused timeout reclaim connection " + mcw);
                            }
                            removemcw = true;
                        }
                    }

                    if (removemcw) {
                        mcWrappersToDestroy.add(mcw);
                        this.totalConnectionCount.decrementAndGet();
                        removemcw = false;
                    }
                } // end of for k loop
                for (int k = 0; k < mcWrappersToDestroy.size(); ++k) {
                    freePool[j].removeMCWrapperFromList(
                                                        mcWrappersToDestroy.get(k),
                                                        mcWrapperDoesExistInFreePool,
                                                        synchronizedAllReady,
                                                        dontNotifyWaiter, // Notifies will be done after cleanupAndDestroyMCWrapper
                                                        // processing
                                                        dontDecrementTotalCounter);
                }

            } // end of synchronized
            if (localConnection_ != null && needToReclaimTLSConnections()) {
                boolean reapTLS = false;
                /*
                 * We can reap connections in the connection pool if we are not in thread sensitive code.
                 */
                updateToTLSPoolInProgress.set(true); // set to true for pausing pool.
                synchronized (updateToTLSPoolInProgressLockObject) {
                    try {
                        sleep(20);
                    } catch (InterruptedException e) {
                    }
                    if (activeTLSRequest.get() > 0) {
                        try {
                            sleep(100);
                        } catch (InterruptedException e) {
                        }
                        if (activeTLSRequest.get() > 0) {
                            // We can not purge tls
                            if (tc.isDebugEnabled()) {
                                Tr.debug(this, tc, "To many active requests to search tls, active request value is " + activeRequest.get());
                            }
                        } else {
                            reapTLS = true;
                        }
                    } else {
                        reapTLS = true;
                    }
                    if (reapTLS) {
                        if (tc.isDebugEnabled()) {
                            Tr.debug(this, tc, "Searching tls for a connections to reap.");
                        }

                        Iterator<Entry<MCWrapper, ArrayList<MCWrapper>>> it = tlsArrayLists.entrySet().iterator();
                        while (it.hasNext()) {
                            Entry<MCWrapper, ArrayList<MCWrapper>> e = it.next();
                            MCWrapper mcw = e.getKey();
                            if (mcw.getPoolState() == MCWrapper.ConnectionState_freeTLSPool) {
                                ArrayList<MCWrapper> mh = e.getValue();
                                if (agedTimeout != -1) {
                                    if (mcw.hasAgedTimedOut(agedTimeoutMillis)) {
                                        mh.remove(mcw);
                                        tlsArrayLists.remove(mcw);
                                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                            ((com.ibm.ejs.j2c.MCWrapper) mcw).setThreadID(((com.ibm.ejs.j2c.MCWrapper) mcw).getThreadID() + "-reclaim-removed");
                                            Tr.debug(this, tc, "removed mcWrapper from thread local " + mcw);
                                        }
                                        mcw.setPoolState(MCWrapper.ConnectionState_noPool);
                                        mcWrappersToDestroy.add(mcw);
                                        this.totalConnectionCount.decrementAndGet();
                                        continue;
                                    }
                                }
                                if (unusedTimeout != -1) {
                                    if (mcw.hasIdleTimedOut(unusedTimeout * 1000)
                                        && (this.totalConnectionCount.get() > minConnections)) {
                                        mh.remove(mcw);
                                        tlsArrayLists.remove(mcw);
                                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                            ((com.ibm.ejs.j2c.MCWrapper) mcw).setThreadID(((com.ibm.ejs.j2c.MCWrapper) mcw).getThreadID() + "-reclaim-removed");
                                            Tr.debug(this, tc, "removed mcWrapper from thread local " + mcw);
                                        }
                                        mcw.setPoolState(MCWrapper.ConnectionState_noPool);
                                        mcWrappersToDestroy.add(mcw);
                                        this.totalConnectionCount.decrementAndGet();
                                    }
                                }
                            }
                        }
                    }
                    updateToTLSPoolInProgress.set(false); // set to false for releasing pool.
                    updateToTLSPoolInProgressLockObject.notifyAll();
                }
            }

            MCWrapper mcw;
            int destroyListSize = mcWrappersToDestroy.size();
            totalNumberOfConnectionRemoved = totalNumberOfConnectionRemoved + destroyListSize;
            for (int k = destroyListSize; k > 0; --k) {
                mcw = mcWrappersToDestroy.remove(k - 1);
                mcw.setInSharedPool(false); // : This mcwrapper is not in shared pool.
                freePool[j].cleanupAndDestroyMCWrapper(mcw);
            }
            for (int k = 0; k < destroyListSize; ++k) { // free one connection at
                //  at a time.
                synchronized (waiterFreePoolLock) {

                    if (waiterCount > 0) {
                        // there are requests waiting, so notify one of them
                        waiterFreePoolLock.notify();
                    }
                } // end sync
            }
        } // end for (int j
        if (tc.isEntryEnabled()) {
            if (tc.isDebugEnabled()) {
                // This information should only be printed if tc.isEntryEnabled()
                // and tc.isDebugEnabled()
                if (totalNumberOfConnectionRemoved > 0) {
                    Tr.debug(
                             tc,
                             "Total number of connections removed are " + totalNumberOfConnectionRemoved);
                } else {
                    Tr.debug(this, tc, "No connection were removed");
                }
                Tr.debug(this, tc, "Current state of pool:");
                Tr.debug(this, tc, this.toString());
            }
            Tr.exit(this, tc, "reclaimConnections");
        }
    }
310867
function ReconnectingConnection(id, connection) {
  this.id = id;
  this.connection = null;
  this.closed = false;
  this.queue = [];

  this.setConnection(connection);
}
261849
def clear_stale_cached_connections!
    keys = @reserved_connections.keys - Thread.list.find_all { |t|
      t.alive?
    }.map { |thread| thread.object_id }
    keys.each do |key|
      checkin @reserved_connections[key]
      @reserved_connections.delete(key)
    end
  end