JMS connections are not closed in case of a failure. Discovered against ActiveMQ, but it applies to other JMS servers.
The problem happens when an exception is raised and the worker is marked as invalid. The current code discards the worker before closing it properly. Below the details.
Any exception happening to a ConsumerJMS or PublisherJMS marks the worker as invalid. After that, the worker is discarded (the worker object reference is never cleaned). Below the snipped code of the issue:
Before discard the worker, it should be cleaned all resources associated with it. The proper solution is to call worker.shutdown() and then discard it.