/*
@see
com.ibm.ws.udp.channel.internal.UDPSelectorMonitor#setChannel(java.nio.
channels.DatagramChannel, com.ibm.ws.udp.channel.internal.UDPNetworkLayer)
493047
public synchronized void setChannel(DatagramChannel channel, UDPNetworkLayer udpNetworkLayer) throws IOException {

        int interestOps = 0;
        if (udpNetworkLayer.getUDPChannel().getConfig().isInboundChannel()) {
            interestOps = SelectionKey.OP_READ;
        }

        NIOChannelModRequest request = new NIOChannelModRequest(NIOChannelModRequest.ADD_REQUEST, channel, interestOps, udpNetworkLayer);
        synchronized (channelModList) {
            channelModList.add(request);
        }
        synchronized (channelRequestingToBeAddedRemovedSync) {
            channelRequestingToBeAddedRemoved = true;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "Adding channel for port: " + channel.socket().getLocalPort() + " to WQM : " + hashCode());
        }

        selector.wakeup();
    }
103364
def set_channels(self, channels):
        
        for key in channels:
            self.set(key, channels[key])
292972
public void setBroadcastInputs(List<NamedChannel> broadcastInputs) {
		if (broadcastInputs != null) {
			this.broadcastInputs = broadcastInputs;
			
			// update the branch map
			for (NamedChannel nc : broadcastInputs) {
				PlanNode source = nc.getSource();
				
				mergeBranchPlanMaps(branchPlan, source.branchPlan);
			}
		}
		
		// do a sanity check that if we are branching, we have now candidates for each branch point
		if (this.template.hasUnclosedBranches()) {
			if (this.branchPlan == null) {
				throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
			}
	
			for (UnclosedBranchDescriptor uc : this.template.getOpenBranches()) {
				OptimizerNode brancher = uc.getBranchingNode();
				if (this.branchPlan.get(brancher) == null) {
					throw new CompilerException("Branching and rejoining logic did not find a candidate for the branching point.");
				}
			}
		}
	}
909097
private void putChannel(final StoredClientChannel channel, boolean updateWallet) {
        lock.lock();
        try {
            mapChannels.put(channel.id, channel);
            channelTimeoutHandler.schedule(new TimerTask() {
                @Override
                public void run() {
                    try {
                        TransactionBroadcaster announcePeerGroup = getAnnouncePeerGroup();
                        removeChannel(channel);
                        announcePeerGroup.broadcastTransaction(channel.contract);
                        announcePeerGroup.broadcastTransaction(channel.refund);
                    } catch (Exception e) {
                        // Something went wrong closing the channel - we catch
                        // here or else we take down the whole Timer.
                        log.error("Auto-closing channel failed", e);
                    }
                }
                // Add the difference between real time and Utils.now() so that test-cases can use a mock clock.
            }, new Date(channel.expiryTimeSeconds() * 1000 + (System.currentTimeMillis() - Utils.currentTimeMillis())));
        } finally {
            lock.unlock();
        }
        if (updateWallet)
            updatedChannel(channel);
    }
1183073
public void addChannel(WebSocketChannel channel) {
        Objects.requireNonNull(channel, Required.CHANNEL.toString());

        final String url = RequestUtils.getWebSocketURL(channel);
        Set<WebSocketChannel> channels = getChannels(url);
        if (channels == null) {
            channels = new HashSet<>();
            channels.add(channel);
        } else {
            channels.add(channel);
        }
        setChannels(url, channels);
    }
1362851
public void init() throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "UDP Channel: " + getConfig().getExternalName() + " listening port: " + String.valueOf(getConfig().getPort()));
        }
    }
9082
public void parameterizeChannel(Channel channel) {
		if (this.ordering != null) {
			channel.setLocalStrategy(LocalStrategy.SORT, this.ordering.getInvolvedIndexes(), this.ordering.getFieldSortDirections());
		} else if (this.groupedFields != null) {
			boolean[] dirs = new boolean[this.groupedFields.size()];
			Arrays.fill(dirs, true);
			channel.setLocalStrategy(LocalStrategy.SORT, Utils.createOrderedFromSet(this.groupedFields), dirs);
		}
	}
362566
public void setLocalNetwork(String localNetwork) {
        IPAddressType currNetworkType = IPAddressCompare.getAddressType(localNetwork);
        this.currNetworkType = currNetworkType;
        this.localNetworkString = localNetwork;

        if (currNetworkType == IPAddressType.IPV4) {
            this.localNetwork = IPAddressCompare.addressToByteArrayV4(localNetwork);
        } else if (currNetworkType == IPAddressType.IPV6) {
            this.localNetwork = IPAddressCompare.addressToByteArrayV6(localNetwork);
        }
    }
896444
public void setNetworkSourceIpV4(java.util.Collection<IpFilter> networkSourceIpV4) {
        if (networkSourceIpV4 == null) {
            this.networkSourceIpV4 = null;
            return;
        }

        this.networkSourceIpV4 = new java.util.ArrayList<IpFilter>(networkSourceIpV4);
    }
25149
public void setChannelReceiveBufferSize(int size) {
        this.channelReceiveBufferSize = size;
        if (size < 0 || size > UDPConfigConstants.MAX_UDP_PACKET_SIZE) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Channel Receive buffer size not within Limits: " + size + " setting to default: " + UDPConfigConstants.MAX_UDP_PACKET_SIZE);
            }
            this.channelReceiveBufferSize = UDPConfigConstants.MAX_UDP_PACKET_SIZE;
        }
    }
68238
private DatagramChannel openUdpChannel(InetAddress localAddress, int port, Selector selector) throws IOException {
		DatagramChannel channel = DatagramChannel.open();
		channel.configureBlocking(false);
		// Register selector for reading operations
		channel.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
		channel.bind(new InetSocketAddress(localAddress, port));
		return channel;
	}
837589
public void setUpdateChannelConfiguration(byte[] updateChannelConfigurationAsBytes) throws InvalidArgumentException {
        if (updateChannelConfigurationAsBytes == null) {
            throw new InvalidArgumentException("UpdateChannelConfiguration updateChannelConfigurationAsBytes must be non-null");
        }
        logger.trace("Creating setUpdateChannelConfiguration from bytes");
        configBytes = updateChannelConfigurationAsBytes;
    }
137161
public void bindLocal(DatagramChannel channel, int port) throws IOException {
        // select port if wildcarded
        if (port == PORT_ANY) {
            port = localPortManager.next();
        }

        // try bind
        IOException ex = null;
        for (int q = 0; q < 100; q++) {
            try {
                channel.bind(new InetSocketAddress(localBindAddress, port));
                ex = null;
                break;
            } catch (IOException e) {
                ex = e;
                logger.info("Failed trying to bind " + localBindAddress + ":" + port);
                port = localPortManager.next();
            }
        }

        if (ex != null) {
            throw ex;
        }
    }
497567
public void setAlertChannels(Collection<AlertChannel> channels)
    {
        for(AlertChannel channel : channels)
        {
            // Add the channel to any policies it is associated with
            List<Long> policyIds = channel.getLinks().getPolicyIds();
            for(long policyId : policyIds)
            {
                AlertPolicy policy = policies.get(policyId);
                if(policy != null)
                    alertChannels(policyId).add(channel);
                else
                    logger.severe(String.format("Unable to find policy for channel '%s': %d", channel.getName(), policyId));
            }
        }
    }
218930
void changeChannelType(final ChannelType newChannelType) throws GraphConversionException {

		if (!this.channelType.equals(newChannelType) && this.userDefinedChannelType) {
			throw new GraphConversionException("Cannot overwrite user defined channel type");
		}

		this.channelType = newChannelType;
	}
55666
@InterfaceAudience.Public
    public void setChannels(List<String> channels) {
        properties.put(ReplicationField.CHANNELS, channels);
        replicationInternal.setChannels(channels);
    }
480243
public void setChannelConfiguration(byte[] channelConfigurationAsBytes) throws InvalidArgumentException {
        if (channelConfigurationAsBytes == null) {
            throw new InvalidArgumentException("ChannelConfiguration channelConfigurationAsBytes must be non-null");
        }
        logger.trace("Creating setChannelConfiguration from bytes");
        this.configBytes = channelConfigurationAsBytes;
    }