Example usage for org.apache.commons.pool2.impl AbandonedConfig getUseUsageTracking

List of usage examples for org.apache.commons.pool2.impl AbandonedConfig getUseUsageTracking

Introduction

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

Prototype

public boolean getUseUsageTracking() 

Source Link

Document

If the pool implements UsageTracking , should the pool record a stack trace every time a method is called on a pooled object and retain the most recent stack trace to aid debugging of abandoned objects?

Usage

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

@Override
public void use(T pooledObject) {
    AbandonedConfig ac = this.abandonedConfig;
    if (ac != null && ac.getUseUsageTracking()) {
        PooledObject<T> wrapper = allObjects.get(new IdentityWrapper<T>(pooledObject));
        wrapper.use();/*ww  w. j  a v  a 2  s  .  c o  m*/
    }
}

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

/**
 * Sets the abandoned object removal configuration.
 *
 * @param abandonedConfig the new configuration to use. This is used by value.
 *
 * @see AbandonedConfig/*from  w  w w .  ja v a2 s  .  co m*/
 */
public void setAbandonedConfig(AbandonedConfig abandonedConfig) throws IllegalArgumentException {
    if (abandonedConfig == null) {
        this.abandonedConfig = null;
    } else {
        this.abandonedConfig = new AbandonedConfig();
        this.abandonedConfig.setLogAbandoned(abandonedConfig.getLogAbandoned());
        this.abandonedConfig.setLogWriter(abandonedConfig.getLogWriter());
        this.abandonedConfig.setRemoveAbandonedOnBorrow(abandonedConfig.getRemoveAbandonedOnBorrow());
        this.abandonedConfig.setRemoveAbandonedOnMaintenance(abandonedConfig.getRemoveAbandonedOnMaintenance());
        this.abandonedConfig.setRemoveAbandonedTimeout(abandonedConfig.getRemoveAbandonedTimeout());
        this.abandonedConfig.setUseUsageTracking(abandonedConfig.getUseUsageTracking());
    }
}