/*
@see com.ibm.wsspi.channelfw.ChannelFramework#getChannel(String)
775301
@Override
    public synchronized ChannelData getChannel(String channelName) {
        ChannelData channel = null;
        if (null != channelName) {
            channel = this.channelDataMap.get(channelName);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getChannel: " + channelName + " found=" + (null != channel));
        }
        return channel;
    }
1125957
protected AgiChannel getChannel()
    {
        AgiChannel threadBoundChannel;

        if (channel != null)
        {
            return channel;
        }

        threadBoundChannel = AgiConnectionHandler.getChannel();
        if (threadBoundChannel == null)
        {
            throw new IllegalStateException("Trying to send command from an invalid thread");
        }

        return threadBoundChannel;
    }
645246
public static ChannelUDT channelUDT(final Channel channel) {
        // bytes
        if (channel instanceof NioUdtByteAcceptorChannel) {
            return ((NioUdtByteAcceptorChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtByteRendezvousChannel) {
            return ((NioUdtByteRendezvousChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtByteConnectorChannel) {
            return ((NioUdtByteConnectorChannel) channel).javaChannel();
        }

        // message
        if (channel instanceof NioUdtMessageAcceptorChannel) {
            return ((NioUdtMessageAcceptorChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtMessageRendezvousChannel) {
            return ((NioUdtMessageRendezvousChannel) channel).javaChannel();
        }
        if (channel instanceof NioUdtMessageConnectorChannel) {
            return ((NioUdtMessageConnectorChannel) channel).javaChannel();
        }

        return null;
    }
953746
private FileChannel getChannel(final boolean append) throws IOException {

		if (this.privateFileChannel == null) {

			java.io.File fileOnDisk = file.getFileOnDisk();

			fileOnDisk.getParentFile().mkdirs();

			this.privateFileChannel = new FileOutputStream(fileOnDisk, append).getChannel();
		}

		return this.privateFileChannel;
	}
32967
public boolean validateChannel(final Channel channel)
    {

        boolean ret = false;
        final SetVarAction var = new SetVarAction(channel, "testState", "1");

        ManagerResponse response = null;
        try
        {
            AsteriskPBX pbx = (AsteriskPBX) PBXFactory.getActivePBX();
            response = pbx.sendAction(var, 500);
        }
        catch (final Exception e)
        {
            ActivityHelper.logger.debug(e, e);
            ActivityHelper.logger.error("getVariable: " + e);
        }
        if ((response != null) && (response.getAttribute("Response").compareToIgnoreCase("success") == 0))
        {
            ret = true;
        }

        return ret;

    }
110154
protected Channel awaitChannel() throws IOException {
        Channel channel = this.channel;
        if(channel != null) {
            return channel;
        }
        synchronized (lock) {
            for(;;) {
                if(state == State.CLOSED) {
                    throw ProtocolLogger.ROOT_LOGGER.channelClosed();
                }
                channel = this.channel;
                if(channel != null) {
                    return channel;
                }
                if(state == State.CLOSING) {
                    throw ProtocolLogger.ROOT_LOGGER.channelClosed();
                }
                try {
                    lock.wait();
                } catch (InterruptedException e) {
                    throw new IOException(e);
                }
            }
        }
    }
954782
public ChannelSftp getSftpChannel() throws SftpException {

    try {
      ChannelSftp channelSftp = (ChannelSftp) this.session.openChannel("sftp");
      channelSftp.connect();
      return channelSftp;
    } catch (JSchException e) {
      throw new SftpException(0, "Cannot open a channel to SFTP server", e);
    }
  }
1204744
def __get_channel(self):
        ""
        if self.__config.get(WebDriverManager.ENABLE_THREADING_SUPPORT, False):
            channel = current_thread().ident
        else:
            channel = 0

        return channel
838862
@Override
    public synchronized ChannelData addChannel(String channelName, Class<?> factoryType, Map<Object, Object> inputPropertyBag, int weight) throws ChannelException {
        return addChannelInternal(channelName, factoryType, inputPropertyBag, weight);
    }
1044135
@Override
    public WsByteBuffer get(byte[] dst, int offset, int length) {
        convertBufferIfNeeded();
        return super.get(dst, offset, length);
    }
1348593
public static String getChannelByChannelId(Long channelId) {
        // 根据channelId 构造path
        return MessageFormat.format(ArbitrateConstants.NODE_CHANNEL_FORMAT, String.valueOf(channelId));
    }
1282790
private ChannelInfo getChannelInfo(int channelId) {
        ChannelInfo info = channels.putIfAbsent(channelId, new ChannelInfo());
        if (info == null) {
            info = channels.get(channelId);
        }
        return info;
    }
191081
@CheckForNull
    public final VirtualChannel getChannel() {
        Computer c = toComputer();
        return c==null ? null : c.getChannel();
    }
450531
protected IPortletDefinition getChannelDefinition(String subId) throws PortalException {
        IPortletDefinition chanDef = mChanMap.get(subId);

        if (null == chanDef) {
            String fname = getFname(subId);
            if (log.isDebugEnabled())
                log.debug(
                        "TransientUserLayoutManagerWrapper>>getChannelDefinition, "
                                + "attempting to get a channel definition using functional name: "
                                + fname);
            try {
                chanDef =
                        PortletDefinitionRegistryLocator.getPortletDefinitionRegistry()
                                .getPortletDefinitionByFname(fname);
            } catch (Exception e) {
                throw new PortalException(
                        "Failed to get channel information " + "for subscribeId: " + subId);
            }
            mChanMap.put(subId, chanDef);
        }

        return chanDef;
    }
792006
@Override
    public Channel getChannelOrFail() throws ChannelClosedException {
        final Channel ch = Channel.current();
        if (ch == null) {
            throw new ChannelClosedException(new IllegalStateException("No channel associated with the thread"));
        }
        return ch;
    }
1099991
public synchronized RuntimeState getChannelState(String channelName, Chain chain) {
        RuntimeState state = null;
        Channel channel = getRunningChannel(channelName, chain);
        if (channel != null) {
            ChannelContainer channelContainer = this.channelRunningMap.get(channel.getName());
            if (null != channelContainer) {
                state = channelContainer.getState();
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getChannelState: " + channelName + "=" + state);
        }
        return state;
    }
87188
@Override
  public void getSubchannel(
      GetSubchannelRequest request, StreamObserver<GetSubchannelResponse> responseObserver) {
    InternalInstrumented<ChannelStats> s = channelz.getSubchannel(request.getSubchannelId());
    if (s == null) {
      responseObserver.onError(
          Status.NOT_FOUND.withDescription("Can't find subchannel " + request.getSubchannelId())
              .asRuntimeException());
      return;
    }

    GetSubchannelResponse resp;
    try {
      resp = GetSubchannelResponse
          .newBuilder()
          .setSubchannel(ChannelzProtoUtil.toSubchannel(s))
          .build();
    } catch (StatusRuntimeException e) {
      responseObserver.onError(e);
      return;
    }

    responseObserver.onNext(resp);
    responseObserver.onCompleted();
  }