Search in sources :

Example 11 with AbandonedConfig

use of org.apache.commons.pool2.impl.AbandonedConfig in project tomcat by apache.

the class BasicDataSource method setAbandonedUsageTracking.

/**
 * If the connection pool implements {@link org.apache.tomcat.dbcp.pool2.UsageTracking UsageTracking}, configure whether
 * the connection pool should record a stack trace every time a method is called on a pooled connection and retain
 * the most recent stack trace to aid debugging of abandoned connections.
 *
 * @param usageTracking A value of <code>true</code> will enable the recording of a stack trace on every use of a
 *                      pooled connection
 */
public void setAbandonedUsageTracking(final boolean usageTracking) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setUseUsageTracking(usageTracking);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig)

Example 12 with AbandonedConfig

use of org.apache.commons.pool2.impl.AbandonedConfig in project tomcat by apache.

the class BasicDataSource method setRemoveAbandonedOnMaintenance.

/**
 * @param removeAbandonedOnMaintenance true means abandoned connections may be removed on pool maintenance.
 * @see #getRemoveAbandonedOnMaintenance()
 */
public void setRemoveAbandonedOnMaintenance(final boolean removeAbandonedOnMaintenance) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setRemoveAbandonedOnMaintenance(removeAbandonedOnMaintenance);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig)

Example 13 with AbandonedConfig

use of org.apache.commons.pool2.impl.AbandonedConfig in project tomcat by apache.

the class BasicDataSource method setLogAbandoned.

/**
 * @param logAbandoned new logAbandoned property value
 */
public void setLogAbandoned(final boolean logAbandoned) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setLogAbandoned(logAbandoned);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig)

Example 14 with AbandonedConfig

use of org.apache.commons.pool2.impl.AbandonedConfig in project tomcat by apache.

the class BasicDataSource method setRemoveAbandonedTimeout.

/**
 * Sets the timeout in seconds before an abandoned connection can be removed.
 * <p>
 * Setting this property has no effect if {@link #getRemoveAbandonedOnBorrow()} and
 * {@link #getRemoveAbandonedOnMaintenance()} are false.
 * </p>
 *
 * @param removeAbandonedTimeout new abandoned timeout in seconds
 * @see #getRemoveAbandonedTimeoutDuration()
 * @see #getRemoveAbandonedOnBorrow()
 * @see #getRemoveAbandonedOnMaintenance()
 * @deprecated Use {@link #setRemoveAbandonedTimeout(Duration)}.
 */
@Deprecated
public void setRemoveAbandonedTimeout(final int removeAbandonedTimeout) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setRemoveAbandonedTimeout(Duration.ofSeconds(removeAbandonedTimeout));
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig)

Aggregations

AbandonedConfig (org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig)7 AbandonedConfig (org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig)6 AbandonedConfig (org.apache.commons.pool2.impl.AbandonedConfig)1