Close down unwanted resources
It is important to free up all the resources used by the application when it terminates. Use the close() method on objects that can be closed (publishers, subscribers, sessions, and connections):
// close publishers and subscribers pub.close(); pubA.close(); sub.close(); subA.close(); sess.close(); // close session and connection sess.close(); conn.close();
uj24710_