Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-3482

Make PooledConnectionFactory's sessionPool non-blocking in case its full.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.6.0
    • None
    • None
    • PooledConnectionFactory

    • Patch Available

    Description

      When using the PooledConnectionFactory it internally caches the JMS Sessions. This is done using a commons pool.
      The amount of sessions to be pooled is controlled by the maximumActive property of the PooledConnectionFactory.

      Right now, when the session pool is full, then any further call to Connection.getSession() will block until a session is available from the pool.
      Depending on whether a connection is returned to the pool, this call might potentially block forever.

      IMHO this is not the best default behavior. Less experienced users might believe the JMS client is hung or suffering a bug if it simply does not return. There is currently no warning logged that this call will block, so no indication of the full session pool is given.

      I propose to change this default behavior and raise a JMSException exception in case the session pool is full and no further Session can be created.
      The underlying commons-pool class org.apache.commons.pool.impl.GenericObjectPoolFactory can be configured easily to raise an ex rather than blocking.
      This will indicate JMS clients that the session pool is full and allows them to take appropriate actions (retry later, or propagate the error upwards).

      Attachments

        1. AMQ-3482.patch
          8 kB
          Torsten Mielke

        Activity

          People

            Unassigned Unassigned
            tmielke Torsten Mielke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: