Can I prevent deamon threads being started by Smack?

I possibly need some education so if you can help me that would be welcome.

I’ve sandboxed Spring Integration support for XMPP adapters using Smack: https://fisheye.springframework.org/browse/se-sia/sandbox/org.springframework.in tegration.xmpp. While I was kicking the tires I noticed that Smack created no less than 4 deamon threads from my testcase.

In the testcase I open two connections and send a message from one to the other over a local xmpp server.

My problem is that in most enterprise servers you’re not supposed to start threads at all. I have two questions:

  1. Can I use a container managed thread pool instead?

  2. Why does smack need to start 4 deamon threads?

Hello,

Smack only creates to threads per connection, so the reason you’re seeing four threads in your test case is because you’re creating two connections. The two threads are used to process incoming (PacketReader) and outgoing (PacketWriter) packets. It may be possible to use a container managed thread pool but it would most likely require extensive changes to the smack code itself.

Hope that helps,

Ryan

Thanks for the quick response. Can I create an issue for this and start pushing? Rolling my own XMPP implementation seems like the only option now and that’s not going to happen anytime soon. Starting daemons in a Java EE server is a big nono, but for the rest Smack is just the thing a lazy bum like me needs .

If you point me in the right direction(s) I’d be happy to take a stab at a patch.