Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-298

Wrong jmxNameBase default value, unable to set jmxNamePrefix

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0, 2.1, 2.2, 2.3, 2.4.1
    • 2.4.2
    • None

    Description

      We needed to define our own pool names for Redis, to be able to know which pool was throwing errors, but we experienced some difficulties.
      We use jedis-2.7.2, which uses commons-pool2-2.3 configured with spring beans. After setting a custom jmxNamePrefix, we didn't notice any difference and proceeded to debug.

      To my understanding, BaseGenericObjectPool.jmxRegister uses BaseObjectPoolConfig.jmxNameBase to build its ObjectName, but jmxNameBase defaults to jmxNamePrefix which is "pool" (not a valid domain) and throws a MalformedObjectNameException, falling back to "org.apache.commons.pool2:type=GenericKeyedObjectPool,name=pool".

      The current workaround is to force jmxNameBase to null with

      <property name="jmxNameBase"><null/></property>

      The fix would be
      https://github.com/apache/commons-pool/blob/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java#L192 (introduced in December 2013 it seems)

      -private String jmxNameBase = DEFAULT_JMX_NAME_PREFIX
      +private String jmxNameBase = DEFAULT_JMX_NAME_BASE
      

      I can submit a Pull Request on Github but it looks like you only use it as a mirror

      Attachments

        Activity

          People

            Unassigned Unassigned
            bcolmard Bastien Colmard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: