Teardown

Removes the connection object from the registry.

@param {String} connectionName
@param {Function} cb
970442
function (connectionName, cb) {

      function shutdownConnection(id) {
        if (connections[id].client) {
          connections[id].client.shutdown();
        }
        delete connections[id];
      }

      if (typeof connectionName == 'function') {
        cb = connectionName;
        connectionName = null;
      }

      // shutdown connections
      if (connectionName) {
        shutdownConnection(connectionName);
      }
      else {
        Object.keys(connections).forEach(function (conn) {
          shutdownConnection(conn);
        });
      }

      cb();
    }
887997
function (conn, cb) {

      // TODO: disconnect here
      if (typeof conn == 'function') {
        cb = conn;
        conn = null;
      }
      if (!conn) {
        connections = {};
        return cb();
      }
      if(!connections[conn]) return cb();
      delete connections[conn];
      cb();
    }
535376
private void remove(PollController conn)
  {
    if (conn == null) {
      return;
    }

    if (_lifecycle.isDestroyed()) {
      return;
    }

    _activeCount.incrementAndGet();

    if (_activeCount.decrementAndGet() == 0 && _lifecycle.isDestroyed()) {
      destroy();
    }
  }
655357
def disconnect(self, event, cb):
        
        try:
            self._callbacks[event].remove(cb)
        except KeyError:
            raise ValueError("{!r} is not a valid cursor event".format(event))
        except ValueError:
            raise ValueError("Callback {} is not registered".format(event))
1213641
function (connectionName, collectionName, cb) {

      var connectionObject = connections[connectionName];
      if (!connectionObject) return cb(Errors.InvalidConnection);

      var collection = connectionObject.collections[collectionName];
      if (!collection) return cb(Errors.CollectionNotRegistered);

      collection.describeTable(cb);
    }
676802
def purge(self, connection):
        """"""
        self._checkpid()
        if connection.pid == self.pid:
            idx = connection._pattern_idx
            if connection in self._in_use_connections[idx]:
                self._in_use_connections[idx].remove(connection)
            else:
                self._available_connections[idx].remove(connection)
            connection.disconnect()
568159
function(conn, cb) {
      log.debug('teardown:', conn);
      /* istanbul ignore if: standard waterline-adapter code */
      if ( typeof conn == 'function') {
        cb = conn;
        conn = null;
      }
      /* istanbul ignore if: standard waterline-adapter code */
      if (!conn) {
        connections = {};
        return cb();
      }
      /* istanbul ignore if: standard waterline-adapter code */
      if (!connections[conn])
        return cb();
      delete connections[conn];
      cb();
    }
121365
function destroy() {
  this.conn = null;
  this.cmd = null;
  this.args = null;
  this.db = null;
  this.info = null;
  this.conf = null;
  this.def = null;
}
569691
function destroy(self, connections) {
  // Destroy all connections
  connections.forEach(function(c) {
    // Remove all listeners
    for (var i = 0; i < events.length; i++) {
      c.removeAllListeners(events[i]);
    }
    // Destroy connection
    c.destroy();
  });

  // Zero out all connections
  self.inUseConnections = [];
  self.availableConnections = [];
  self.nonAuthenticatedConnections = [];
  self.connectingConnections = [];

  // Set state to destroyed
  stateTransition(self, DESTROYED);
}
1299692
function clear(options, cb) {
    if (typeof options === 'function') { cb = options; options = {}; }
    debug('clear ' + key);
    connect();
    redis.del(key, cb);
  }
449743
public static synchronized void unregisterCCMConnection(String poolName, Object mcp, Object cl,
                                                           Object connection, String key)
   {
      log.tracef("%s", new TraceEvent(poolName,
                                      Integer.toHexString(System.identityHashCode(mcp)),
                                      TraceEvent.UNREGISTER_CCM_CONNECTION,
                                      Integer.toHexString(System.identityHashCode(cl)),
                                      Integer.toHexString(System.identityHashCode(connection)),
                                      key));
   }
754632
def deregister(cls, name: str) -> None:
        
        if name not in cls.available:
            raise ConnectionPluginNotRegistered(
                f"Connection {name!r} is not registered"
            )
        cls.available.pop(name)
683654
private void close(ManagedConnection mc)
   {
      log.debugf("Closing managed connection for recovery (%s)", mc);

      if (mc != null)
      {
         try
         {
            mc.cleanup();
         }
         catch (ResourceException ire)
         {
            log.debugf("Error during recovery cleanup", ire);
         }
      }

      if (mc != null)
      {
         try
         {
            mc.destroy();
         }
         catch (ResourceException ire)
         {
            log.debugf("Error during recovery destroy", ire);
         }
      }

      // The managed connection for recovery is now gone
      recoverMC = null;
   }
1291057
public void closeConnection(String name) {
    final URI uri = uriWithPath("./connections/" + encodePathSegment(name));
    deleteIgnoring404(uri);
  }
1006236
function enableDestroy(server) {
    var connections = [];
    server.on('connection', function (conn) {
        var key = connections.push(conn);
        conn.on('close', function () {
            delete connections[key];
        });
    });
    server.destroy = function (cb) {
        server.close(cb);
        for (var key in connections)
            connections[key].destroy();
    };
}
509271
void releaseConnection(ConnectionPool pool, Cassandra.Client conn)
    {
        if (pool != null && conn != null)
        {
            pool.release(conn);
        }
    }
88365
def teardown(self):
        
        with self._teardown_lock:
            if not self._teardown_called:
                self._teardown_called = True
                if len(self._acquiring_session_ids) > 0:
                    logger.info(
                        f"Destroying all sessions that have not acquired keys: {self._acquiring_session_ids}...")
                for session_id in self._acquiring_session_ids:
                    try:
                        self.consul_client.session.destroy(session_id=session_id)
                        logger.debug(f"Destroyed: {session_id}")
                    except requests.exceptions.ConnectionError as e:
                        logger.debug(f"Exception: {e}")
                        logger.warning(f"Could not connect to Consul to clean up session {session_id}")
                atexit.unregister(self.teardown)