如何阻止Netty在服务器套接字上侦听和接受 [英] How to stop netty from listening and accepting on server socket
本文介绍了如何阻止Netty在服务器套接字上侦听和接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法可以告诉netty停止侦听和接受套接字上的新连接,但是要完成当前连接上正在进行的所有工作?
Is there a way to tell netty to stop listening and accepting new connections on a socket, but to finish up any ongoing job on current connections?
推荐答案
您可以仅关闭由ChannelFactory
创建的ServerSocketChannel
.通常,ServerSocketChannel
由ServerBootstrap.bind()
返回.
You can just close the ServerSocketChannel
created by the ChannelFactory
. Usually, the ServerSocketChannel
is returned by ServerBootstrap.bind()
.
这篇关于如何阻止Netty在服务器套接字上侦听和接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文