Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netty 如何在第二次启动时处理引导启动错误_Netty_Bootstrapping - Fatal编程技术网

Netty 如何在第二次启动时处理引导启动错误

Netty 如何在第二次启动时处理引导启动错误,netty,bootstrapping,Netty,Bootstrapping,有人可以帮助我了解两次启动同一引导服务器时的棘手行为。 我看不出有什么例外。 请参阅我的代码: bootstrap = new ServerBootstrap(); bootstrap.group(nioEventLoopGroup); bootstrap.channel(NioServerSocketChannel.class); bootstrap.option(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); bootstrap.op

有人可以帮助我了解两次启动同一引导服务器时的棘手行为。 我看不出有什么例外。 请参阅我的代码:

bootstrap = new ServerBootstrap();

bootstrap.group(nioEventLoopGroup);
bootstrap.channel(NioServerSocketChannel.class);

bootstrap.option(ChannelOption.TCP_NODELAY, Boolean.valueOf(true));
bootstrap.option(ChannelOption.SO_KEEPALIVE, Boolean.valueOf(true));
bootstrap.option(ChannelOption.SO_REUSEADDR, Boolean.valueOf(true));

bootstrap.childHandler(new ServerSocketBasedInitializer(messageFacade));

allChannels.add(bootstrap.bind(new InetSocketAddress(80)).channel());

我正在使用netty4.0.0.Beta2。

我可能不理解您的意思,但我认为您要做的是检查bind()操作返回的ChannelFuture,看看它是否成功

bind()是一个异步操作,因此不能直接执行。如果要阻止,直到完成,ad get和异常自动抛出,请使用bind().sync()。

请参阅我的答案: