from interface ChannelSpeakProvider
327345
public void speak (ClientObject caller, final ChatChannel channel, String message, byte mode)
    {
        BodyObject body = _locator.forClient(caller);
        final UserMessage umsg = new UserMessage(body.getVisibleName(), null, message, mode);

        // if we're hosting this channel, dispatch it directly
        if (_channels.containsKey(channel)) {
            dispatchSpeak(channel, umsg);
            return;
        }

        // if we're resolving this channel, queue up our message for momentary deliver
        List<UserMessage> msgs = _resolving.get(channel);
        if (msgs != null) {
            msgs.add(umsg);
            return;
        }

        // forward the speak request to the server that hosts the channel in question
        _peerMan.invokeNodeAction(new ChannelAction(channel) {
            @Override protected void execute () {
                _channelMan.dispatchSpeak(_channel, umsg);
            }
        }, new Runnable() {
            public void run () {
                _resolving.put(channel, Lists.newArrayList(umsg));
                resolveAndDispatch(channel);
            }
        });
    }
1353517
def wrap_create_channel(create_channel_func, tracer=None):
    """"""
    def call(*args, **kwargs):
        channel = create_channel_func(*args, **kwargs)

        try:
            target = kwargs.get('target')
            tracer_interceptor = OpenCensusClientInterceptor(tracer, target)
            intercepted_channel = grpc.intercept_channel(
                channel, tracer_interceptor)
            return intercepted_channel  # pragma: NO COVER
        except Exception:
            log.warning(
                'Failed to wrap create_channel, '
                'clientlibs grpc calls not traced.')
            return channel
    return call
92638
@Override
    public boolean asyncCheckBuffers(InterChannelCallback callback) {
        try {
            return checkBuffer();
        } catch (IOException ioe) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "We should never get to this point, exception was : " + ioe);
            }
        }
        return false;
    }
524891
@Override
	public void dispatchFromOutputChannel(Envelope envelope) throws IOException, InterruptedException {
		EnvelopeReceiverList receiverList = getReceiverListForEnvelope(envelope, true);

		Buffer srcBuffer = envelope.getBuffer();
		Buffer destBuffer = null;
		
		boolean success = false;
		
		try {
			if (receiverList.hasLocalReceiver()) {
				ChannelID receiver = receiverList.getLocalReceiver();
				Channel channel = this.channels.get(receiver);

				if (channel == null) {
					throw new LocalReceiverCancelledException(receiver);
				}

				if (!channel.isInputChannel()) {
					throw new IOException("Local receiver " + receiver + " is not an input channel.");
				}

				InputChannel<?> inputChannel = (InputChannel<?>) channel;
				
				// copy the buffer into the memory space of the receiver 
				if (srcBuffer != null) {
					try {
						destBuffer = inputChannel.requestBufferBlocking(srcBuffer.size());
					} catch (InterruptedException e) {
						throw new IOException(e.getMessage());
					}

					srcBuffer.copyToBuffer(destBuffer);
					envelope.setBuffer(destBuffer);
					srcBuffer.recycleBuffer();
				}
				
				inputChannel.queueEnvelope(envelope);
				success = true;
			}
			else if (receiverList.hasRemoteReceiver()) {
				RemoteReceiver remoteReceiver = receiverList.getRemoteReceiver();

				// Generate sender hint before sending the first envelope over the network
				if (envelope.getSequenceNumber() == 0) {
					generateSenderHint(envelope, remoteReceiver);
				}

				this.nettyConnectionManager.enqueue(envelope, remoteReceiver);
				success = true;
			}
		} finally {
			if (!success) {
				if (srcBuffer != null) {
					srcBuffer.recycleBuffer();
				}
				if (destBuffer != null) {
					destBuffer.recycleBuffer();
				}
			}
		}
	}
1221392
private ChannelInitializer<SocketChannel> getChannelInitializer(final PravegaNodeUri location,
                                                                    final FlowHandler handler) {
        final SslContext sslCtx = getSslContext();

        return new ChannelInitializer<SocketChannel>() {
            @Override
            public void initChannel(SocketChannel ch) throws Exception {
                ChannelPipeline p = ch.pipeline();
                if (sslCtx != null) {
                    SslHandler sslHandler = sslCtx.newHandler(ch.alloc(), location.getEndpoint(), location.getPort());

                    if (clientConfig.isValidateHostName()) {
                        SSLEngine sslEngine = sslHandler.engine();
                        SSLParameters sslParameters = sslEngine.getSSLParameters();
                        sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
                        sslEngine.setSSLParameters(sslParameters);
                    }
                    p.addLast(sslHandler);
                }
                p.addLast(
                        new ExceptionLoggingHandler(location.getEndpoint()),
                        new CommandEncoder(handler.getBatchSizeTracker()),
                        new LengthFieldBasedFrameDecoder(WireCommands.MAX_WIRECOMMAND_SIZE, 4, 4),
                        new CommandDecoder(),
                        handler);
            }
        };
    }
504565
public void registerCallback(String importer, ChannelChangeCallback callback) {
        Preconditions.checkArgument(
                importer != null && !importer.trim().isEmpty(),
                "importer is null or empty"
                );
        callback = checkNotNull(callback, "callback is null");

        if (m_done.get()) return;

        int [] stamp = new int[]{0};
        NavigableMap<String,ChannelChangeCallback> prev = null;
        NavigableMap<String,ChannelChangeCallback> next = null;
        ImmutableSortedMap.Builder<String,ChannelChangeCallback> mbldr = null;

        synchronized (m_undispatched) {
            do {
                prev = m_callbacks.get(stamp);
                mbldr = ImmutableSortedMap.naturalOrder();
                mbldr.putAll(Maps.filterKeys(prev, not(equalTo(importer))));
                mbldr.put(importer, callback);
                next = mbldr.build();
            } while (!m_callbacks.compareAndSet(prev, next, stamp[0], stamp[0]+1));

            NavigableSet<String> registered = next.navigableKeySet();
            NavigableSet<String> unregistered = m_unregistered.getReference();

            Iterator<ImporterChannelAssignment> itr = m_undispatched.iterator();
            while (itr.hasNext()) {
                final ImporterChannelAssignment assignment = itr.next();
                if (registered.contains(assignment.getImporter())) {
                    final ChannelChangeCallback dispatch = next.get(assignment.getImporter());
                    m_buses.submit(new DistributerRunnable() {
                        @Override
                        public void susceptibleRun() throws Exception {
                            dispatch.onChange(assignment);
                        }
                    });
                    itr.remove();
                } else if (unregistered.contains(assignment.getImporter())) {
                    itr.remove();
                    if (!assignment.getAdded().isEmpty()) {
                        LOG.warn("(" + m_hostId
                                + ") discarding assignment to unregistered importer "
                                + assignment);
                    }
                }
            }
        }
    }
831774
private void probeChannel() {
    if (isStopped()) return;

    try {
      if (selector.selectNow() > 0) {
        final Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();

        while (iterator.hasNext()) {
          final SelectionKey key = iterator.next();
          iterator.remove();

          if (key.isValid()) {
            if (key.isAcceptable()) {
              accept(key);
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      logger().log("Failed to accept client channel for '" + name + "' because: " + e.getMessage(), e);
    }
  }
549029
public static channel_interface_binding[] get(nitro_service service, String id) throws Exception{
		channel_interface_binding obj = new channel_interface_binding();
		obj.set_id(id);
		channel_interface_binding response[] = (channel_interface_binding[]) obj.get_resources(service);
		return response;
	}
1238803
@Override
	public Promise subscribe(String channel) {
		if (dispatcher != null) {
			try {
				dispatcher.subscribe(channel);
			} catch (Exception cause) {
				return Promise.reject(cause);
			}
		}
		return Promise.resolve();
	}
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;
    }
854291
private void fireOnGetBasic(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onGetBasic(e);
        }
    }
952137
@Override
    public ChannelBuffer buffer() throws Exception {
        int payloadLen = 0;
        if (_message != null)
            payloadLen = _message.length;

        int totalLen = 8 + payloadLen;
        ChannelBufferOutputStream bout = new ChannelBufferOutputStream(ChannelBuffers.directBuffer(totalLen));
        bout.writeShort(_type);

        if (_task > Short.MAX_VALUE)
            throw new RuntimeException("Task ID should not exceed " + Short.MAX_VALUE);

        bout.writeShort((short) _task);
        bout.writeInt(payloadLen);
        if (payloadLen > 0)
            bout.write(_message);

        bout.close();
        return bout.buffer();
    }
69018
@Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        super.channelInactive(ctx);

        if (currentMessage != null && currentMessage.getExtras() != null) {
            if (currentMessage.getExtras().refCnt() > 0) {
                currentMessage.getExtras().release();
            }
        }

        if (currentMessage != null && currentMessage.getFramingExtras() != null) {
            if (currentMessage.getFramingExtras().refCnt() > 0) {
                currentMessage.getFramingExtras().release();
            }
        }

        resetDecoder();
    }
794880
@ConditionalOnMissingBean(GrpcChannelFactory.class)
    @Bean
    public GrpcChannelFactory inProcessGrpcChannelFactory(final GrpcChannelsProperties properties,
            final GlobalClientInterceptorRegistry globalClientInterceptorRegistry,
            final List<GrpcChannelConfigurer> channelConfigurers) {
        return new InProcessChannelFactory(properties, globalClientInterceptorRegistry, channelConfigurers);
    }
40845
public void init(ChannelFactoryData data) throws ChannelFactoryException {
        // Note, this call will throw an exception if any properties are invalid.
        new TCPFactoryConfiguration(data.getProperties());

        boolean asyncIOEnabled = ChannelFrameworkImpl.getRef().getAsyncIOEnabled();
        // see if an alternate Comm channel class was specified, if so load it
        commClassName = TCPFactoryConfiguration.getCommClass(asyncIOEnabled);
        if (commClassName != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Using comm class name [" + commClassName + "]");
            }
            boolean loaded = false;
            final ClassLoader cl = TCPChannelFactory.class.getClassLoader();
            if (cl != null) {
                try {
                    final String name = commClassName;
                    commClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>()
                    {
                        public Class<?> run() throws Exception
                    {
                        return cl.loadClass(name);
                    }
                    });
                    loaded = true;
                } catch (Exception e) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "loadClass failed; " + e);
                    }
                    FFDCFilter.processException(e, getClass().getName() + ".init", "132", this);
                }
            }

            // try using the default loader, although that will probably fail also
            if (!loaded) {
                try {
                    final String name = commClassName;
                    commClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>()
                    {
                        public Class<?> run() throws Exception
                    {
                        return Class.forName(name);
                    }
                    });
                    loaded = true;
                } catch (Exception e) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Class.forName failed; " + e);
                    }
                    FFDCFilter.processException(e, getClass().getName() + ".init", "144", this);
                }
            }
        }
    }
831463
function Channel(connection, spec) {
    this.connection = connection;
    this.channelId = spec.channelId;
    this.canPublish = spec.canPublish;
    this.subscribedTopics = [];
    this.fireCallbacks = {};
    this.prepareCallbacks = {};

    ObjectFsm(this);
    this.initStateMachine();

    /* Hackery */
    this.reportTransition('uninitialized');
}
1004779
function clientNetworkData(channelDefArray, opt) {
	var self = {
		__TYPE__ : MessageType.CS_NET,
		channelCount : new type.UInt32Le( function () {
			return self.channelDefArray.obj.length;
		}),
		channelDefArray : channelDefArray || new type.Factory( function (s) {
			self.channelDefArray = new type.Component([]);
			
			for (var i = 0; i < self.channelCount.value; i++) {
				self.channelDefArray.obj.push(channelDef().read(s));
			}
		})
	};
	
	return new type.Component(self, opt);
}