Example usage for org.apache.commons.pool2.impl BaseObjectPoolConfig getJmxEnabled

List of usage examples for org.apache.commons.pool2.impl BaseObjectPoolConfig getJmxEnabled

Introduction

In this page you can find the example usage for org.apache.commons.pool2.impl BaseObjectPoolConfig getJmxEnabled.

Prototype

public boolean getJmxEnabled() 

Source Link

Document

Gets the value of the flag that determines if JMX will be enabled for pools created with this configuration instance.

Usage

From source file:JDBCPool.dbcp.demo.sourcecode.BaseGenericObjectPool.java

/**
 * Handles JMX registration (if required) and the initialization required for
 * monitoring./*from  w w  w. j  av  a  2  s.  c om*/
 *
 * @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<ClassLoader>(cl);
    }

    fairness = config.getFairness();
}