9 Replies Latest reply on Aug 6, 2008 6:52 AM by Kevin Conner

    JmsConnectionPool overflows sometimes with JBossMQ

    Pavel Kadlec Novice

      Hello,

      I know that JBoss Messaging is recommended JMS provider, but I was forced to use JBossMQ because of bug in JBossMesasaging http://www.jboss.com/index.html?module=bb&op=viewtopic&t=139214

      JBossMQ works great for me except for JmsConnectionPool sometimes overflows.

      I know when the pool overflows and what is the reason.

      The core reason is that JBossMQ's XAConnectionFactory.createSession always creates XASession (is always transacted and with SESSION_TRANSACTED acknowledgement mode), but JBossMessaging's XAConnectionFactory.createSession creates non-xa Session (transacted or non-transacted and with customized acknowledgement mode). The JmsConnectionPool is intended to be used with JBossMessaging behaviour only.

      The overflow occurs when caller thread associated with *NO* transaction sends esb message (by jms courier) using *XAConnectionFactory* to the esb service.

      In this case the connection pool uses XAConnectionFactory.createSession for creating the session. The pool has hashmaps which key is acknowledgement mode. JBossMQ's XAConnectionFactory.createSession always creates Session with SESSION_TRANSACTED acknowledgement mode. But the pool registers the session under customized acknowledgement mode into the maps (eg. AUTO_ACKNOWLEDGE). When session clean is called, the JmsConnectionPool tries to remove the session from the pool, but uses Session.getAcknowledgement to find out what type of session it is. This returns SESSION_TRANSACTED mode, but session was registered under eg. AUTO_ACKNOWLEDGE mode. The pool is not cleaned up correctly and overflows.


      Regards
      Pavel Kadlec