Search in sources :

Example 6 with AbandonedConfig

use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig in project ddf by codice.

the class LdapLoginConfig method createGenericPoolAbandonConfig.

private AbandonedConfig createGenericPoolAbandonConfig() {
    AbandonedConfig abandonedConfig = new AbandonedConfig();
    abandonedConfig.setRemoveAbandonedOnBorrow(true);
    abandonedConfig.setRemoveAbandonedTimeout(FIVE_MIN_S);
    return abandonedConfig;
}
Also used : AbandonedConfig(org.apache.commons.pool2.impl.AbandonedConfig)

Example 7 with AbandonedConfig

use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig in project datanucleus-rdbms by datanucleus.

the class BasicDataSource method setAbandonedUsageTracking.

/**
 * If the connection pool implements {@link org.datanucleus.store.rdbms.datasource.dbcp2.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.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig)

Example 8 with AbandonedConfig

use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig in project datanucleus-rdbms by datanucleus.

the class BasicDataSource method setRemoveAbandonedOnBorrow.

/**
 * @param removeAbandonedOnBorrow true means abandoned connections may be removed when connections are borrowed from
 *                                the pool.
 * @see #getRemoveAbandonedOnBorrow()
 */
public void setRemoveAbandonedOnBorrow(final boolean removeAbandonedOnBorrow) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setRemoveAbandonedOnBorrow(removeAbandonedOnBorrow);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig)

Example 9 with AbandonedConfig

use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig in project datanucleus-rdbms by datanucleus.

the class BasicDataSource method setAbandonedLogWriter.

/**
 * Sets the print writer to be used by this configuration to log information on abandoned objects.
 *
 * @param logWriter The new log writer
 */
public void setAbandonedLogWriter(final PrintWriter logWriter) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setLogWriter(logWriter);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig)

Example 10 with AbandonedConfig

use of org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.AbandonedConfig in project datanucleus-rdbms by datanucleus.

the class BasicDataSource method setRemoveAbandonedTimeout.

/**
 * <p>
 * Sets the timeout in seconds before an abandoned connection can be removed.
 * </p>
 *
 * <p>
 * Setting this property has no effect if {@link #getRemoveAbandonedOnBorrow()} and
 * {@link #getRemoveAbandonedOnMaintenance()} are false.
 * </p>
 *
 * @param removeAbandonedTimeout new abandoned timeout in seconds
 * @see #getRemoveAbandonedTimeout()
 * @see #getRemoveAbandonedOnBorrow()
 * @see #getRemoveAbandonedOnMaintenance()
 */
public void setRemoveAbandonedTimeout(final int removeAbandonedTimeout) {
    if (abandonedConfig == null) {
        abandonedConfig = new AbandonedConfig();
    }
    abandonedConfig.setRemoveAbandonedTimeout(removeAbandonedTimeout);
    final GenericObjectPool<?> gop = this.connectionPool;
    if (gop != null) {
        gop.setAbandonedConfig(abandonedConfig);
    }
}
Also used : AbandonedConfig(org.datanucleus.store.rdbms.datasource.dbcp2.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 GenericObjectPoolConfig (org.datanucleus.store.rdbms.datasource.dbcp2.pool2.impl.GenericObjectPoolConfig)1