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

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

Introduction

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

Prototype

public void setUseUsageTracking(boolean useUsageTracking) 

Source Link

Document

If the pool implements UsageTracking , configure whether the pool should 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:ch.cyberduck.core.pool.DefaultSessionPool.java

public DefaultSessionPool(final ConnectionService connect, final X509TrustManager trust,
        final X509KeyManager key, final VaultRegistry registry, final PathCache cache,
        final TranscriptListener transcript, final Host bookmark) {
    this.connect = connect;
    this.registry = registry;
    this.cache = cache;
    this.bookmark = bookmark;
    this.transcript = transcript;
    final GenericObjectPoolConfig configuration = new GenericObjectPoolConfig();
    configuration.setJmxEnabled(false);//from  ww w.  j av  a2s  .co  m
    configuration.setEvictionPolicyClassName(CustomPoolEvictionPolicy.class.getName());
    configuration.setBlockWhenExhausted(true);
    configuration.setMaxWaitMillis(BORROW_MAX_WAIT_INTERVAL);
    this.pool = new GenericObjectPool<Session>(
            new PooledSessionFactory(connect, trust, key, cache, bookmark, registry), configuration);
    final AbandonedConfig abandon = new AbandonedConfig();
    abandon.setUseUsageTracking(true);
    this.pool.setAbandonedConfig(abandon);
}