uudashr/jsmpp — pull request #38 by TomasAndersen (2014-11-06 10:02:53+00:00)
Title: Fixed deadlock in SMPPSession/AbstractSession close methods

I am using the jsmpp API to listen for incoming SMS messages on a socket connection.
In average this socket connection stopped each 24 hours. I could also make it stop by breaking the network connection between my server and the SMPP Gateway.

I turned out that it was a deadlock causing the EnquireLinkSender thread waiting for the PDUReader thread and visa versa.

This pull request moves all cleanup code into the superclass (AbstractSession) and I have added a check for which thread is calling the close method.

After running with this patch the SMPP API is able to close properly without any deadlock.

I have added a watchdog in my code outside the SMPP API that reconnect the SMPP Session when this happens.