I’m reading the source code to the Smack api and the the method XMPPConnection#disconnect looks like this:
public void disconnect(Presence unavailablePresence) { // If not connected, ignore this request. if (packetReader == null || packetWriter == null) { return; } shutdown(unavailablePresence); if (roster != null) { roster.cleanup(); roster = null; } wasAuthenticated = false; packetWriter.cleanup(); packetWriter = null; packetReader.cleanup(); packetReader = null; }
In my scenario, I am storing a live XMPPConnection inside a class called Session. A separate thread of execution will attempt to close my instance of XMPPConnection by calling Session#shutdown(). As I see it, I will have to cooperatively tell Session to close the XMPPConnection by acquiring a mutex or something. Correct?
Looks like it’s a known bug.