我开始使用Ignite Smack API 4.1.6在TCP客户端上创建基本的XMPP。我使用smack-tcp和smack-java7 API。代码非常基础。
//In a main
//Create XMPPTCPConnectionConfiguration
//Create XMPPTCPConnection using the configuration
//connect and login
成功登录并发送第一条在线状态消息后,似乎当时主要代码执行连接的代码已关闭。
我预计API会创建一个TCP套接字连接,它仍然存在于一个单独的线程中,但似乎这不是我得到的行为。
有什么建议吗?
感谢。
答案 0 :(得分:1)
如果存在main()
方法并且只剩下守护进程,则JVM将存在。 Smack专门使用守护进程线程。因此,您的JVM存在。
另见if main method completes the execution, what happens to any long running thread?