Menu

#67 bug in public function force_unbind()(version:0.3.7)

open
nobody
5
2012-09-15
2007-08-09
Anonymous
No
public void force_unbind() {
    LOGGER.warn("Attempting to force SMPP connection down.");
    try {
        setState(UNBOUND);
        // Give the receiver a chance to die.
        Thread.yield();
        // The thread must DIE!!!!
        if (rcvThread != null && rcvThread.isAlive()) {
            try {
                // Wait to see if the thread will terminate due to the state
                // becoming UNBOUND.
                Thread.sleep(1000);
           } catch (InterruptedException x) {
                LOGGER.debug(
                        "Interrupted exception waiting on receiver to die",
                        x);
           }
            if (rcvThread != null) {
                LOGGER.error("Listener thread has not died.");
            }

            rcvThread = null;
        }

        link.close();
    } catch (Throwable t) {
        LOGGER.warn("Exception when trying to force unbind", t);
    }
    return;
}

if rcvThread is started in for asyncronous communication,when rcvThread blocks on statement

run()
{
....
pak = readNextPacketInternal();
...
}

your resolution to destroy rcvThread is with no effec,and probably produces some exception

Discussion

MongoDB Logo MongoDB