Cleans up this managed connection prior to returning it to the free pool.
Invalidates any connection handles still associated with the managed
connection as, in the normal case, they would all have been dissociated
before cleanup was started.
550106
public void cleanup() throws ResourceException {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "cleanup");
        }

        // Invalidate any currently associated connections
        for (Iterator iterator = _connections.iterator(); iterator.hasNext();) {

            final SibRaConnection connection = (SibRaConnection) iterator
                    .next();
            connection.invalidate();

        }

        // If we have a connection exception then we must have hit a problem with getting the
        // physical connection. We need to throw an exception here to force the destroy of this
        // managed connection else it goes in the free pool. I better solution would be to expose
        // an api that we can call on jca, this is work in progress.
        if (_connectionException != null)
        {
          //The string used here is searched for by jca so that it won't log the error
            ResourceException exception = new ResourceException("Skip logging for this failing connection");
            if (TRACE.isEventEnabled()) {
              SibTr.exception(this, TRACE, exception);
            }
            throw exception;
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "cleanup");
        }

    }
559936
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.items():
            if assoc.expiresIn == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
1229632
@Override
    @Trivial
    public void cleanUpState(VirtualConnection vc) {
        vc.getStateMap().remove(HttpDispatcherLink.LINK_ID);
    }
932806
private void internalCleanup()
    {
        if(hasBroker())
        {
            PersistenceBroker broker = getBroker();
            if(log.isDebugEnabled())
            {
                log.debug("Do internal cleanup and close the internal used connection without" +
                        " closing the used broker");
            }
            ConnectionManagerIF cm = broker.serviceConnectionManager();
            if(cm.isInLocalTransaction())
            {
                /*
                arminw:
                in managed environment this call will be ignored because, the JTA transaction
                manager control the connection status. But to make connectionManager happy we
                have to complete the "local tx" of the connectionManager before release the
                connection
                */
                cm.localCommit();
            }
            cm.releaseConnection();
        }
    }
533740
void invalidate()
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "invalidate"
                            );

        // Prevent any attempt to load the object.
        objectStore = null;

        // If the ManagedObject is already in memory access it, otherwise there is nothing
        // we need to do to it.
        if (managedObjectReference != null) {
            ManagedObject managedObject = (ManagedObject) managedObjectReference.get();
            if (managedObject != null)
                managedObject.state = ManagedObject.stateError;
        } // if (managedObjectReference != null).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "invalidate"
                            );
    }
291657
public void cleanup ()
    {
        // tell any pending object subscribers that they're not getting their bits
        for (PendingRequest<?> req : _penders.values()) {
            for (Subscriber<?> sub : req.targets) {
                sub.requestFailed(req.oid, new ObjectAccessException("Client connection closed"));
            }
        }
        _penders.clear();
        _flusher.cancel();
        _flushes.clear();
        _dead.clear();
        _client.getRunQueue().postRunnable(new Runnable() {
            public void run () {
                _ocache.clear();
            }
        });
    }
328295
def clean(self, force: bool=False):
        '''
        '''
        with (yield from self._lock):
            for connection in tuple(self.ready):
                if force or connection.closed():
                    connection.close()
                    self.ready.remove(connection)
801243
def _finalCleanup(self):
        
        for conn in self._connections.values():
            conn.releaseConnectionResources()
        assert not self._connections
816105
private boolean cleanUp(Reference<?> reference) {
    Method finalizeReferentMethod = getFinalizeReferentMethod();
    if (finalizeReferentMethod == null) {
      return false;
    }
    do {
      /*
       * This is for the benefit of phantom references. Weak and soft
       * references will have already been cleared by this point.
       */
      reference.clear();

      if (reference == frqReference) {
        /*
         * The client no longer has a reference to the
         * FinalizableReferenceQueue. We can stop.
         */
        return false;
      }

      try {
        finalizeReferentMethod.invoke(reference);
      } catch (Throwable t) {
        logger.log(Level.SEVERE, "Error cleaning up after reference.", t);
      }

      /*
       * Loop as long as we have references available so as not to waste
       * CPU looking up the Method over and over again.
       */
    } while ((reference = queue.poll()) != null);
    return true;
  }
310781
def free(self, connection):
        
        LOGGER.debug('Pool %s freeing connection %s', self.id, id(connection))
        try:
            self.connection_handle(connection).free()
        except KeyError:
            raise ConnectionNotFoundError(self.id, id(connection))

        if self.idle_connections == list(self.connections.values()):
            with self._lock:
                self.idle_start = self.time_method()
        LOGGER.debug('Pool %s freed connection %s', self.id, id(connection))
543137
def cleanup(self):
        
        # Closes connections to all databases to avoid the long running process
        # from holding connections indefinitely.
        for alias in db.connections.databases:
            logger.info('Closing database connection: %s', alias)
            db.connections[alias].close()
165942
async def _cleanup_old_connections(self):
        

        retval = await self._command_task.future_command(['_query_systemstate'])

        for conn in retval['active_connections']:
            self._logger.info("Forcible disconnecting connection %d", conn)
            await self._command_task.future_command(['_disconnect', conn])
1120717
private void cleanRestoredHandles() throws Exception {
		synchronized (pendingCheckpoints) {

			Iterator<PendingCheckpoint> pendingCheckpointIt = pendingCheckpoints.iterator();
			while (pendingCheckpointIt.hasNext()) {
				PendingCheckpoint pendingCheckpoint = pendingCheckpointIt.next();

				if (committer.isCheckpointCommitted(pendingCheckpoint.subtaskId, pendingCheckpoint.checkpointId)) {
					pendingCheckpoint.stateHandle.discardState();
					pendingCheckpointIt.remove();
				}
			}
		}
	}
1142498
def free(cls, pid, connection):
        
        with cls._lock:
            LOGGER.debug('Freeing %s from pool %s', id(connection), pid)
            cls._ensure_pool_exists(pid)
            cls._pools[pid].free(connection)
1202173
public static function clearRelatedInstancePool()
    {
        // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
                DealerShedulesTableMap::clearInstancePool();
                DealerContactTableMap::clearInstancePool();
                DealerContentTableMap::clearInstancePool();
                DealerFolderTableMap::clearInstancePool();
                DealerBrandTableMap::clearInstancePool();
                DealerProductTableMap::clearInstancePool();
                DealerAdminTableMap::clearInstancePool();
                DealerI18nTableMap::clearInstancePool();
                DealerVersionTableMap::clearInstancePool();
            }
43651
protected void purgeClosedConnection(OutboundConnection connection)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "purgeClosedConnection", connection);
        purge(connection, false, false);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "purgeClosedConnection");
    }
1001942
public void dissociateConnections() throws ResourceException
   {
      // We don't call cleanup(), as cleanup() could be doing additional contracts
      // with the physical connection
      
      for (HelloWorldConnectionImpl connection : connections)
      {
         connection.setManagedConnection(null);
      }
      connections.clear();
   }