views:

183

answers:

1

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?

+3  A: 

Looks like it's a known bug.

Dan Breslau
Thanks for pointing out the bug. It is inevitable then that I sync externally before calling it. Peace.
Jacques René Mesrine