Reputation: 369
I started using the Ignite Smack API 4.1.6 for creating a basic XMPP over TCP client. I use the smack-tcp and smack-java7 API. The code is pretty basic.
//In a main
//Create XMPPTCPConnectionConfiguration
//Create XMPPTCPConnection using the configuration
//connect and login
After logged in successfully and sent the first presence message, it seems that at the time the code into the main finishes executing the connection is shut down.
I expected that the API would created a TCP socket connection that stays alive into a separate thread, but it seems that it's not the behaviour I get.
Any suggestions?
Thanks.
Upvotes: 1
Views: 170
Reputation: 24083
The JVM will exists if the main()
method exists and if there a only daemon treads left. Smack uses daemon threads exclusively. Thus your JVM exists.
See also if main method completes the execution, what happens to any long running thread?
Upvotes: 1