List of usage examples for io.netty.channel Channel parent
Channel parent();
From source file:bftsmart.communication.client.netty.NettyClientServerCommunicationSystemClientSide.java
License:Apache License
private void closeChannelAndEventLoop(Channel c) { // once having an event in your handler (EchoServerHandler) // Close the current channel c.close();/*www. j a v a 2s.com*/ // Then close the parent channel (the one attached to the bind) if (c.parent() != null) { c.parent().close(); } workerGroup.shutdownGracefully(); }
From source file:com.addthis.meshy.MeshyServer.java
License:Apache License
@Override protected void channelConnected(Channel channel, ChannelState channelState) { super.channelConnected(channel, channelState); /* servers peer with other servers once a channel comes up */ // assign unique id (local or remote inferred) channelState.setName("temp-uuid-" + nextSession.incrementAndGet()); InetSocketAddress address = (InetSocketAddress) channel.remoteAddress(); if (channel.parent() == null) { log.debug("{} >>> starting peering with {}", MeshyServer.this, address); new PeerSource(this, channelState.getName()); }/*from www.j a v a 2 s . c om*/ }
From source file:org.waarp.ftp.core.utils.FtpChannelUtils.java
License:Open Source License
/** * Return the number of still positive command connections * //from www. ja v a 2 s . c o m * @param configuration * @return the number of positive command connections */ public static int validCommandChannels(FtpConfiguration configuration) { int result = 0; Channel channel = null; Iterator<Channel> iterator = configuration.getFtpInternalConfiguration().getCommandChannelGroup() .iterator(); while (iterator.hasNext()) { channel = iterator.next(); if (channel.parent() != null) { // Child Channel if (channel.isActive()) { // Normal channel result++; } else { WaarpSslUtility.closingSslChannel(channel); } } else { // Parent channel result++; } } return result; }