AnsweredAssumed Answered

Not closing smack threads by disconnect (4.1.0-alpha1-SNAPSHOT)

Question asked by Patrick Loka on Dec 19, 2014
Latest reply on Sep 1, 2016 by Amruta

Hello everybody,

 

I am looking for some advice in my little smack project. I made my own IM-App on Android. For this reason I want to close my connections sometimes, for example if I dont have internet connection (that happens quite often) on my phone or when I don't want to chat. In this case I call connection.disconnect(). After that I set my roster null, my connection referece null and let my GC do its work.

 

Unfortunatly is the disconnect method not closing all the smack threads related to the closed connection. In detail: By establishing a connection, 4 threads are started:

Smack Packet Writer (0)

Smack Packet Reader (0)

Smack Executor Service 0 (0)

Smack Scheduled Ping Executor Service (0)

 

But after disconnecting only 2 threads are being closed (the reader and the writer). So two threads are still running (the two executors) even though there is no connection or a connection object. This causes 6 threads after the next connect() call:

 

Smack Executor Service 0 (0)

Smack Scheduled Ping Executor Service (0)

Smack Packet Writer (1)

Smack Packet Reader (1)

Smack Executor Service 0 (1)

Smack Scheduled Ping Executor Service (1)

 

Any idea what I did wrong or is this a (maybe known) bug?

 

In hope for advice

PaLoka88

Outcomes