Example usage for org.apache.commons.pool2.impl GenericObjectPoolConfig getJmxNamePrefix

List of usage examples for org.apache.commons.pool2.impl GenericObjectPoolConfig getJmxNamePrefix

Introduction

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

Prototype

public String getJmxNamePrefix() 

Source Link

Document

Gets the value of the JMX name prefix that will be used as part of the name assigned to JMX enabled pools created with this configuration instance.

Usage

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

/**
 * Create a new <code>GenericObjectPool</code> using a specific
 * configuration.//from w ww  .  j  ava  2s .  c  o  m
 *
 * @param factory   The object factory to be used to create object instances
 *                  used by this pool
 * @param config    The configuration to use for this pool instance. The
 *                  configuration is used by value. Subsequent changes to
 *                  the configuration object will not be reflected in the
 *                  pool.
 */
public GenericObjectPool(PooledObjectFactory<T> factory, GenericObjectPoolConfig config) {

    super(config, ONAME_BASE, config.getJmxNamePrefix());

    if (factory == null) {
        jmxUnregister(); // tidy up
        throw new IllegalArgumentException("factory may not be null");
    }
    this.factory = factory;

    idleObjects = new LinkedBlockingDeque<PooledObject<T>>(config.getFairness());

    setConfig(config);

    startEvictor(getTimeBetweenEvictionRunsMillis());
}