Long lived JMS sessions. Is Keeping JMS connections / JMS sessions always opened a bad practice?

前端 未结 5 674
野性不改
野性不改 2021-02-14 08:25

Is keeping JMS connections / sessions / consumer always open a bad practice?

Code draft example:

// app startup code

ConnectionFactory cf = (ConnectionF         


        
5条回答
  •  时光说笑
    2021-02-14 09:12

    FYI, there is no need to close the sessions, producers, and consumers of a closed connection( javax.jms.Connection ). The code below should be enough to release the resources:

    try { 
            this.connection.close();
        } catch (JMSException e) {
            //
        }
    

提交回复
热议问题