ActiveMQ
  1. ActiveMQ
  2. AMQ-393

Stopping a PooledConnectionFactory leaves JmsSessionDispatcher threads running

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 4.0 M4
    • Component/s: JMS client
    • Labels:
      None

      Description

      When a PooledConnectionFactory is stopped, ObjectPools created by the SessionPools aren't closed, and therefore PooledSessions remain running. Since the underlying ActiveMQSession isn't actually closed when the PooledSession is closed, the ActiveMQSessionExecutor and its worker threads are never stopped. I added a method to PooledConnection called "destroyPools" which will close the ObjectPools associated with a connection. The differences are pasted below.

      diff oldpool/PooledConnection.java pool/PooledConnection.java
      21a22
      > import java.util.Iterator;
      154a156,163
      > protected void destroyPools() {
      > Iterator i = cache.values().iterator();
      > while (i.hasNext())

      { > SessionPool pool = (SessionPool) i.next(); > i.remove(); > pool.close(); > }

      > }
      diff oldpool/PooledConnectionFactory.java pool/PooledConnectionFactory.java
      95a96
      > connection.destroyPools();
      diff oldpool/SessionPool.java pool/SessionPool.java
      98c98,104
      <

      > protected void close() {
      > if (sessionPool != null) {
      > try

      { > sessionPool.close(); > }

      catch (Exception e) {}
      > }
      > }

        Activity

        Hide
        james strachan added a comment -

        The issue is resolved in 4.0, not in 3.2

        Show
        james strachan added a comment - The issue is resolved in 4.0, not in 3.2
        Hide
        beyond005 added a comment -

        I fix the files in ActiveMQ3.2 source code and rebuild it. But the problem still happen. The JmsSessionDispatcher threads increase to a big number and cause the test program hang. What's the problem?

        Show
        beyond005 added a comment - I fix the files in ActiveMQ3.2 source code and rebuild it. But the problem still happen. The JmsSessionDispatcher threads increase to a big number and cause the test program hang. What's the problem?
        Hide
        james strachan added a comment -

        patch applied, thanks Jeremy

        Show
        james strachan added a comment - patch applied, thanks Jeremy

          People

          • Assignee:
            Unassigned
            Reporter:
            Jeremy Volkman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development