/*
@see com.ibm.wsspi.channelfw.ChannelFramework#getRunningChains()
761815
@Override
    public synchronized ChainData[] getRunningChains() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getRunningChains");
        }

        ChainData chainDataArray[] = new ChainData[chainRunningMap.size()];
        ChainDataImpl chainData = null;
        int index = 0;

        Iterator<Chain> chainIter = chainRunningMap.values().iterator();
        while (chainIter.hasNext()) {
            chainData = (ChainDataImpl) chainIter.next().getChainData();
            // Extract the external version, hiding all child channel data objects.
            chainDataArray[index++] = chainData.getExternalChainData();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getRunningChains");
        }
        return chainDataArray;
    }
1154890
public boolean getRunningCollaborators()
    {
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        // 321485
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"getRunningCollaborators", " value --> " + String.valueOf(_runningCollaborators));
        }
        return _runningCollaborators;
    }
1012759
@Override
    public Set<Stream> getResultStreams() {
    	Set<Stream> streams = ImmutableSet.of(this.resultStream);
		return streams;
    }
350915
public List<Chain> getChains(){
		ArrayList<Chain> chains = new ArrayList<>();

		chains.addAll(polyChains);
		chains.addAll(nonPolyChains);
		chains.addAll(waterChains);

		chains.trimToSize();

		return chains;
	}
1076927
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);
                }
            }
        }
    }
613812
@Override
    public synchronized ChainData createOutboundChain() throws ChannelFrameworkException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "createOutboundChain");
        }

        // Check to see if the chain has already been created.
        if (outboundChainData == null) {
            this.outboundChainData = framework.createOutboundChain(this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "createOutboundChain");
        }
        return this.outboundChainData;
    }
18852
@Override
    public synchronized boolean isChainRunning(String chainName) {
        boolean rc = false;
        if (null != chainName) {
            Chain c = this.chainRunningMap.get(chainName);
            if (null != c) {
                rc = c.getState().equals(RuntimeState.STARTED) || c.getState().equals(RuntimeState.QUIESCED);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "isChainRunning: " + chainName + " " + rc);
        }
        return rc;
    }
735310
@Override
    public synchronized ChainData addChain(String chainName, FlowType chainType, String[] channelNameList) throws ChannelException, ChainException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "addChain: " + chainName);
        }
        if (null == chainName) {
            throw new InvalidChainNameException("Input chain name is null");
        }
        if (null == channelNameList || 0 == channelNameList.length) {
            throw new InvalidChannelNameException("Invalid channel list");
        }

        ChainDataImpl chainData = chainDataMap.get(chainName);
        // Ensure the chain name doesn't already exist in the framework.
        if (null != chainData) {
            InvalidChainNameException e = new InvalidChainNameException("Chain config already exists, " + chainName);
            FFDCFilter.processException(e, getClass().getName() + ".addChain", "1411", this, new Object[] { chainData });
            throw e;
        }

        int zRegion = RegionType.NOT_ON_Z;
        boolean okToAdd = true;
        ChannelFactory factory = null;

        // Determine if we are running on Z, and if so, what region we are in
        if (currentlyOnZ()) {
            zRegion = currentZRegion();
        }

        // Ensure each of the channel configurations already exist in the framework.
        ChannelData[] channelDataArray = new ChannelData[channelNameList.length];
        ChannelData channelData = null;
        int i = 0;
        int lastIndex = channelNameList.length - 1;
        for (i = 0; i <= lastIndex; i++) {
            factory = null;
            channelData = channelDataMap.get(channelNameList[i]);
            if (null == channelData) {
                InvalidChannelNameException e = new InvalidChannelNameException("Can't add chain config due to unknown channel, " + channelNameList[i]);
                FFDCFilter.processException(e, getClass().getName() + ".addChain", "1443", this, new Object[] { channelNameList[i] });
                throw e;
            }
            if (zRegion != RegionType.NOT_ON_Z && chainType.equals(FlowType.INBOUND)) {
                // On Z and inbound, need to do some special Z things
                if (i == lastIndex) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "On Z, looking at Application Channel, " + channelData.getName());
                    }
                    // Looking at the Inbound Application Channel
                    factory = getChannelFactoryInternal(channelData.getFactoryType(), false);

                    if (zRegion == RegionType.SR_REGION) {
                        // in SR, check if we should start this chain
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Operating in Servant Region");
                        }
                        if (factory instanceof BoundRegion) {
                            if (!(((BoundRegion) factory).isServantStartable(channelDataMap))) {
                                // channel does not want to start given the current
                                // configuration
                                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                    Tr.debug(tc, "Channel says it is not startable in Servant Region");
                                }
                                okToAdd = false;
                            }
                        }
                    } else if ((zRegion == BoundRegion.CR_REGION) || (zRegion == BoundRegion.CRA_REGION)) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Operating in CR or CRA Region, Region constant: " + zRegion);
                        }
                        // In a secure region. check if the channel implements BoundRegion,
                        // and is configured to run in this region
                        if (factory instanceof BoundRegion) {
                            if (zRegion != (((BoundRegion) factory).getRegion(channelDataMap))) {
                                // channel does not support running in this region
                                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                    Tr.debug(tc, "This Channel says it is not startable in this Region: getRegion returned: " + ((BoundRegion) factory).getRegion(channelDataMap));
                                }
                                okToAdd = false;
                            }
                        }
                    }
                } else {
                    // Not Looking at an application channel in the chain
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "On Z, looking at non-application Channel, " + channelData.getName());
                    }

                    if ((zRegion == BoundRegion.CR_REGION) || (zRegion == BoundRegion.CRA_REGION)) {
                        // mark what region this channel is being asked to run in, and
                        // log a warning if this gives a sharable problem
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Operating in CR or CRA Region, Region constant: " + zRegion);
                        }

                        // Get Channel entry from HashMap
                        Integer channelEntry = ChannelZRegions.get(channelData.getName());
                        if (channelEntry == null) {
                            // new entry
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "First time setting region entry for this channel");
                            }
                            ChannelZRegions.put(channelData.getName(), Integer.valueOf(zRegion));
                        } else {
                            // check to see if we are being asked to run in a different region
                            int entryValue = channelEntry.intValue();

                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Not first time setting region entry for this channel, current region entry is: " + entryValue);
                            }

                            if ((entryValue & zRegion) == 0) {
                                // being asked to be run in a different region, see if this is
                                // sharable
                                factory = getChannelFactoryInternal(channelData.getFactoryType(), false);
                                if (factory instanceof CrossRegionSharable) {
                                    if (!(((CrossRegionSharable) factory).isSharable(channelDataMap))) {
                                        // non-sharable channel is being put into different regions
                                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                            Tr.debug(tc, "Channel says it is not sharable");
                                        }
                                        Tr.warning(tc, "channel.shared.warning", new Object[] { channelData.getName() });

                                    }
                                }
                                // update regions that this channel is being used in
                                ChannelZRegions.put(channelData.getName(), Integer.valueOf(entryValue | zRegion));
                            }
                        }
                    }
                }
            }
            channelDataArray[i] = channelData;
        } // end-for loop on channels

        if (okToAdd) {
            try {
                // Store values for the host and port in the chain if it is inbound.
                Map<Object, Object> chainProperties = null;
                if (FlowType.INBOUND.equals(chainType)) {
                    chainProperties = new HashMap<Object, Object>();
                    Map<Object, Object> tcpProperties = channelDataArray[0].getPropertyBag();
                    chainProperties.put(ChannelFrameworkConstants.HOST_NAME, tcpProperties.get(ChannelFrameworkConstants.HOST_NAME));
                    chainProperties.put(ChannelFrameworkConstants.PORT, tcpProperties.get(ChannelFrameworkConstants.PORT));
                    chainProperties.put(ChannelFrameworkConstants.LISTENING_PORT, tcpProperties.get(ChannelFrameworkConstants.LISTENING_PORT));
                }
                chainData = (ChainDataImpl) createChainData(chainName, chainType, channelDataArray, chainProperties);
                // Add the new chain to the framework configuration.
                this.chainDataMap.put(chainName, chainData);
                // Associate any global chain event listeners.
                for (int j = 0; j < globalChainEventListeners.size(); j++) {
                    chainData.addChainEventListener(globalChainEventListeners.get(j));
                }
            } catch (IncoherentChainException e) {
                FFDCFilter.processException(e, getClass().getName() + ".addChain", "1601", this, new Object[] { chainName, chainType, channelDataArray });
                throw e;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "addChain");
        }
        return chainData;
    }
273797
public String getRunningFlowIds() {
    final List<Integer> allIds = new ArrayList<>();
    getRunningFlowsIdsHelper(allIds, this.queuedFlows.getAllEntries());
    getRunningFlowsIdsHelper(allIds, this.runningExecutions.get().values());
    Collections.sort(allIds);
    return allIds.toString();
  }
814368
@Override
    public void serverStopping() {
        // If the system is configured to quiesce connections..
        long timeout = chfw.getDefaultChainQuiesceTimeout();
        if (timeout > 0) {
            ChainData[] runningChains = chfw.getRunningChains();

            // build list of chain names to pass to stop, use ChannelUtils.stopChains so as to not return until the
            // channels are inactive or the quiesce timeout has hit.
            List<String> names = new ArrayList<String>();
            for (int i = 0; i < runningChains.length; i++) {
                if (FlowType.INBOUND.equals(runningChains[i].getType())) {
                    names.add(runningChains[i].getName());
                }
            }

            ChannelUtils.stopChains(names, -1, null);

        }
    }
150
@Override
  public List<ExecutableFlow> getRunningFlows() {
    final ArrayList<ExecutableFlow> flows = new ArrayList<>();
    try {
      getFlowsHelper(flows, this.executorLoader.fetchUnfinishedFlows().values());
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows.", e);
    }
    return flows;
  }
963697
public synchronized Channel getRunningChannel(String inputChannelName, Chain chain) {
        if (inputChannelName == null || chain == null) {
            return null;
        }

        Channel channel = null;
        // Ensure the chain is running.
        if (null != this.chainRunningMap.get(chain.getName())) {
            ChannelData[] channels = chain.getChannelsData();
            for (int index = 0; index < channels.length; index++) {
                if (channels[index].getExternalName().equals(inputChannelName)) {
                    channel = chain.getChannels()[index];
                    break;
                }
            }
        }
        return channel;
    }
235999
public ArrayList getChunks() {
        ArrayList tmp = new ArrayList();
        Chunk chunk;
        Iterator i = iterator();
        boolean localDestination = (reference != null && reference.startsWith("#"));
        boolean notGotoOK = true;
        while (i.hasNext()) {
            chunk = (Chunk) i.next();
            if (name != null && notGotoOK && !chunk.isEmpty()) {
                chunk.setLocalDestination(name);
                notGotoOK = false;
            }
            if (localDestination) {
                chunk.setLocalGoto(reference.substring(1));
            }
            else if (reference != null)
                chunk.setAnchor(reference);
            tmp.add(chunk);
        }
        return tmp;
    }
425100
public List<IPRangeNode> getChain(InetAddress iaddr) {

	List<IPRangeNode> result = new ArrayList();

	result.add(root);

	IPRangeNode node = isV4(iaddr) ? ipv4 : ipv6;
	node.findFast(iaddr, result);

	return result;
    }
45029
public Vector<Object> getAllRunners()
    {
        try
        {
            List<Runner> runners = service.getAllRunners();

            log.debug("Retrieved All Runner number: " + runners.size());
            return XmlRpcDataMarshaller.toXmlRpcRunnersParameters(runners);
        }
        catch (Exception e)
        {
            return errorAsVector(e, RUNNERS_NOT_FOUND);
        }
    }
214937
@Override
    public synchronized VirtualConnectionFactory getOutboundVCFactory(String chainName) throws ChannelException, ChainException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getOutboundVCFactory: " + chainName);
        }
        if (null == chainName) {
            throw new InvalidChainNameException("Unable to get VCFactory for null chain name");
        }

        OutboundVirtualConnectionFactoryImpl vc = outboundVCFactories.get(chainName);
        if (vc == null) {
            // VC Factory does not exist
            ChainData chainData = chainDataMap.get(chainName);
            if (null != chainData) {
                // Create new VCF. Note this initializes the chain and sets the ref
                // count to 1.
                vc = createVirtualConnectionFactory(chainData);
                outboundVCFactories.put(chainName, vc);
            } else if (-1 != chainName.indexOf(ChannelDataImpl.CHILD_STRING)) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                    Tr.exit(tc, "getOutboundVCFactory");
                }
                return getNestedOutboundVCFactory(chainName);
            } else {
                InvalidChainNameException exp = new InvalidChainNameException("Chain configuration not found in framework, " + chainName);
                // FFDCFilter.processException(exp,
                // getClass().getName()+".getOutboundVCFactory", "459", this, new
                // Object[] {chainName});
                throw exp;
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Found existing VCF, " + chainName);
            }
            vc.incrementRefCount();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getOutboundVCFactory");
        }
        return vc;
    }
1335808
public static List<String> getDefaultConversionProviderChain(){
        List<String> defaultChain = getMonetaryConversionsSpi()
                .getDefaultProviderChain();
        Objects.requireNonNull(defaultChain, "No default provider chain provided by SPI: " +
                getMonetaryConversionsSpi().getClass().getName());
        return defaultChain;
    }