/**
   * Handles JMX registration (if required) and the initialization required for monitoring.
   *
   * @param config Pool configuration
   * @param jmxNameBase The default base JMX name for the new pool unless overridden by the config
   * @param jmxNamePrefix Prefix to be used for JMX name for the new pool
   */
  public BaseGenericObjectPool(
      BaseObjectPoolConfig config, String jmxNameBase, String jmxNamePrefix) {
    if (config.getJmxEnabled()) {
      this.oname = jmxRegister(config, jmxNameBase, jmxNamePrefix);
    } else {
      this.oname = null;
    }

    // Populate the creation stack trace
    this.creationStackTrace = getStackTrace(new Exception());

    // save the current TCCL (if any) to be used later by the evictor Thread
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if (cl == null) {
      factoryClassLoader = null;
    } else {
      factoryClassLoader = new WeakReference<>(cl);
    }

    fairness = config.getFairness();
  }