/*
Close all the EntityManagerFactory instances associated to the persistence unit(s) of the
input module.

@param modName Module name.
325251
private final void close(String modName, boolean remove) //PK59717
    {
        synchronized (puScopes) {
            JPAScopeInfo scopeInfo = puScopes.get(modName);
            if (scopeInfo != null) {
                scopeInfo.close();
                if (remove) //PK59717
                    puScopes.remove(modName);
            }
        }
    }
705720
@Override
  @Nullable
  CompilerInput.ModuleType getModuleTypeByName(String moduleName) {
    return moduleTypesByName.get(moduleName);
  }
1336338
public void clear() {
        Node<K,V>[] tab;
        modCount++;
        if ((tab = table) != null && size > 0) {
            size = 0;
            for (int i = 0; i < tab.length; ++i)
                tab[i] = null;
        }
    }
730282
public void clear() {
        modCount++;
        Object[] tab = table;
        for (int i = 0; i < tab.length; i++)
            tab[i] = null;
        size = 0;
    }
420669
@Override
	public final void close() throws JMSException
    {
    	synchronized (closeLock)
		{
	    	if (closed)
	    		return;
	    	closed = true;
		}
    	
    	ActivityWatchdog.getInstance().unregister(this);
    	
    	synchronized (storeLock)
		{
	        if (volatileStore != null)
	        {
	            volatileStore.close();
	            
	            // Delete message store if the queue was temporary
	            if (queueDef.isTemporary())
	                volatileStore.delete();
	        }
	        if (persistentStore != null)
	        {
	            persistentStore.close();
	            
	            // Delete message store if the queue was temporary
	            if (queueDef.isTemporary())
	                persistentStore.delete();
	        }
		}
    	
    	// Create a snapshot to avoid concurrent modification
    	List<LocalMessageConsumer> consumers;
    	consumersLock.readLock().lock();
    	try
    	{
    		if (localConsumers.isEmpty())
    			return;
    		
    		consumers = new ArrayList<>(localConsumers);
    	}
    	finally
    	{
    		consumersLock.readLock().unlock();
    	}	
    		
    	// Close all consumers
    	for (int n=0;n<consumers.size();n++)
        {
	        LocalMessageConsumer consumer = consumers.get(n);
	        try
	        {
	            consumer.close();
	        }
	        catch (JMSException e)
	        {
	            ErrorTools.log(e, log);
	        }
        }
    }
159353
@Override
    public void close() throws IOException {
        super.close();
        if (entity != null) {

            entity.close();
        }
        if (snapshot != null) snapshot.close();
    }
151731
@Override
    public void close(ClusterName clusterName) {
        logger.info("Close connection to cluster [" + clusterName + "] from connector [" + this.getClass().getSimpleName()  + "]");
        connectionHandler.closeConnection(clusterName.getName());

    }
739929
@Override
    public void destroy()
    {
        if (indexManager != null)
        {
            indexManager.close();
        }
        if (schemaManager != null)
        {
            schemaManager.dropSchema();
        }
        schemaManager = null;
        externalProperties = null;
        releaseConnection(this.session);
        ((Cluster) getConnectionPoolOrConnection()).closeAsync();
    }
1275723
protected final void closeConnection(final JsMessagingEngine messagingEngine) {

        final String methodName = "closeConnection";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, messagingEngine);
        }

        closeConnection(messagingEngine.getUuid().toString());

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

    }
1331327
public void clear() {
        modCount++;
        for (int i = 0; i < size; i++)
            queue[i] = null;
        size = 0;
    }
1298638
public void destroy() {

        m_attributeName = null;
        m_attributeType = null;
        m_attributeValueViews.clear();
        m_attributeValueViews = null;
        m_dndHandler = null;
        m_entity = null;
        m_entityType = null;
        m_entityBackEnd = null;
        m_widgetService = null;
    }
753437
@Override
    public void destroy()
    {
        indexManager.close();
        if (schemaManager != null)
        {
            schemaManager.dropSchema();
        }
        if (sparkContext != null)
        {
            logger.info("Closing connection to spark.");
            sparkContext.stop();
            logger.info("Closed connection to spark.");
        }
        else
        {
            logger.warn("Can't close connection to Spark, it was already disconnected");
        }
        externalProperties = null;
        schemaManager = null;
    }
129465
public void removeAppBindings(ModuleMetaData mmd, List<String> names) {

        ApplicationMetaData amd = mmd.getApplicationMetaData();

        Lock writeLock = javaColonLock.writeLock();
        writeLock.lock();

        try {
            JavaColonNamespaceBindings<EJBBinding> bindings = getAppBindingMap(amd);
            // getAppBindings returns a non-null value

            for (String name : names) {
                bindings.unbind(name);
            }

        } finally {
            writeLock.unlock();
        }
    }
491557
public void clear() {
		hashCodeUpToDate = false;
		modCount++;

		// clear to let GC do its work
		for (int i = 0; i < size; i++)
			elementData[i] = null;

		size = 0;
	}
865706
public void stoppingModule(EJBModuleMetaDataImpl mmd) { // F743-26072
        boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "stoppingModule: " + mmd.getJ2EEName());

        // If the application is stopping (rather than a single module), then
        // we don't need to do anything special.
        if (!ivStopping) {
            mmd.ivStopping = true;
            ivModules.remove(mmd);

            try {
                beginStopping(false, mmd.getJ2EEName(), Collections.singletonList(mmd));
            } finally {
                // If fine-grained module start failed, be sure to clear
                // internal state.
                ivSingletonDependencies = null;
                ivStartupSingletonList = null;
                ivQueuedNonPersistentTimers = null;
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "stoppingModule");
    }
314358
@Override
    void closeNoTxEntityManager(JPANoTxEmInvocation noTxInvocation)
    {
        EntityManager em = noTxInvocation.ivEm;
        if (em != null && em.isOpen())
        {
            // Pooling of this entity manager will only be allowed if the getDelegate()
            // method has not been invoked on the entity manager.  If it has then we will
            // need to close it instead.
            if (noTxInvocation.ivAllowPooling) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "closeNoTxEntityManager is pooling noTx em: " + em);

                ivEntityManagerPool.putEntityManager(em);
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "closeNoTxEntityManager is closing noTx em: " + em);

                em.close();
            }
        }
    }
273467
@Invalidate
    void shutdown() {
        if (repository != null) {
            repository.dispose();
        }

        if (emRegistration != null) {
            emRegistration.unregister();
        }
        if (entityManager != null) {
            entityManager.close();
        }
        if (emfRegistration != null) {
            emfRegistration.unregister();
        }
        if (entityManagerFactory != null) {
            entityManagerFactory.close();
        }
        if (transformer != null) {
            transformer.unregister(sourceBundle.bundle);
        }
    }