Refine search
@Override public ServerSocketChannel newChannel() { switch (transportType) { case EPOLL: return new EpollServerSocketChannel(); case KQUEUE: return new KQueueServerSocketChannel(); case NIO: return new NioServerSocketChannel(); default: throw new IllegalArgumentException("Invalid or unknown Netty transport type " + transportType); } } }
/** * Create a new instance using the given {@link ServerSocketChannel}. */ public NioServerSocketChannel(ServerSocketChannel channel) { super(null, channel, SelectionKey.OP_ACCEPT); config = new NioServerSocketChannelConfig(this, javaChannel().socket()); }
/** * Create a new instance using the given {@link SelectorProvider}. */ public NioServerSocketChannel(SelectorProvider provider) { this(newSocket(provider)); }
@Override protected void doBind(SocketAddress localAddress) throws Exception { if (PlatformDependent.javaVersion() >= 7) { javaChannel().bind(localAddress, config.getBacklog()); } else { javaChannel().socket().bind(localAddress, config.getBacklog()); } }
@Override protected void doClose() throws Exception { javaChannel().close(); }
private ServerSocketChannel jdkChannel() { return ((NioServerSocketChannel) channel).javaChannel(); } }
public void run() throws InterruptedException { NioServerSocketChannel channel = (NioServerSocketChannel) new ServerBootstrap().group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(nettyLogLevel())) .childHandler(initializer) .bind(properties.getPort()) .sync() .channel(); this.port = channel.localAddress().getPort(); dumpProperties(); }
@Override public void stop() { serverChannel.close(); }
@Override protected void doBind(SocketAddress localAddress) throws Exception { if (PlatformDependent.javaVersion() >= 7) { javaChannel().bind(localAddress, config.getBacklog()); } else { javaChannel().socket().bind(localAddress, config.getBacklog()); } }
@Override protected void doClose() throws Exception { javaChannel().close(); }
private ServerSocketChannel jdkChannel() { return ((NioServerSocketChannel) channel).javaChannel(); } }
logger.info(String.format("ServerSocketChannel bound to=%s ", this.serverChannelTcp.localAddress()));
@Override protected SocketAddress localAddress0() { return SocketUtils.localSocketAddress(javaChannel().socket()); }
@Override protected void doBind(SocketAddress localAddress) throws Exception { if (PlatformDependent.javaVersion() >= 7) { javaChannel().bind(localAddress, config.getBacklog()); } else { javaChannel().socket().bind(localAddress, config.getBacklog()); } }
@Override protected void doClose() throws Exception { javaChannel().close(); }
switch (socketType) { case JAVA_NIO: return (T) new NioServerSocketChannel(); case NATIVE_EPOLL: return (T) new EpollServerSocketChannel();
/** * Create a new instance */ public NioServerSocketChannel() { this(newSocket(DEFAULT_SELECTOR_PROVIDER)); }
private ServerSocketChannel jdkChannel() { return ((NioServerSocketChannel) channel).javaChannel(); } }
@Override public boolean isActive() { return javaChannel().socket().isBound(); }
@Override protected void doBind(SocketAddress localAddress) throws Exception { if (PlatformDependent.javaVersion() >= 7) { javaChannel().bind(localAddress, config.getBacklog()); } else { javaChannel().socket().bind(localAddress, config.getBacklog()); } }