private static void unloadChains(Iterator<String> chains) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();

        List<String> runningChains = new LinkedList<String>();
        while (chains.hasNext()) {
            ChainData cd = cf.getChain(chains.next());
            if (null != cd && FlowType.INBOUND.equals(cd.getType())) {
                if (bTrace && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Unloading chain; " + cd.getName());
                }
                try {
                    if (cf.isChainRunning(cd)) {
                        runningChains.add(cd.getName());
                    } else {
                        cf.destroyChain(cd);
                        cf.removeChain(cd);
                    }
                } catch (Exception e) {
                    FFDCFilter.processException(e, "ChannelUtils",
                                                "unloadChains", new Object[] { cd, cf });
                    if (bTrace && tc.isEventEnabled()) {
                        Tr.event(tc, "Unable to remove chain; " + cd.getName());
                    }
                }
            }
        }

        // Stop chains, and wait for stop to complete...
        stopChains(runningChains, -1L, null);
        for (String name : runningChains) {
            ChainData cd = cf.getChain(name);
            if (bTrace && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unloading stopped chain; " + name);
            }
            try {
                cf.destroyChain(cd);
                cf.removeChain(cd);
            } catch (Exception e) {
                FFDCFilter.processException(e, "ChannelUtils", "unloadChains",
                                            new Object[] { cd, cf });
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Unable to remove chain; " + name);
                }
            }
        }
    }
private static void unloadChains ( Iterator < String > chains ) { final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; final ChannelFramework cf = ChannelFrameworkFactory . getChannelFramework ( ) ; List < String > runningChains = new LinkedList < String > ( ) ; while ( chains . hasNext ( ) ) { ChainData cd = cf . getChain ( chains . next ( ) ) ; if ( null != cd && FlowType . INBOUND . equals ( cd . getType ( ) ) ) { if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unloading chain; " + cd . getName ( ) ) ; } try { if ( cf . isChainRunning ( cd ) ) { runningChains . add ( cd . getName ( ) ) ; } else { cf . destroyChain ( cd ) ; cf . removeChain ( cd ) ; } } catch ( Exception e ) { FFDCFilter . processException ( e , "ChannelUtils" , "unloadChains" , new Object [ ] { cd , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to remove chain; " + cd . getName ( ) ) ; } } } } stopChains ( runningChains , - 1L , null ) ; for ( String name : runningChains ) { ChainData cd = cf . getChain ( name ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unloading stopped chain; " + name ) ; } try { cf . destroyChain ( cd ) ; cf . removeChain ( cd ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , "ChannelUtils" , "unloadChains" , new Object [ ] { cd , cf } ) ; if ( bTrace && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Unable to remove chain; " + name ) ; } } } }
Stop and unload any of the provided chain names that might exist and be
currently running.

@param chains