use of org.apache.commons.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);
}
}
use of org.apache.commons.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);
}
}
use of org.apache.commons.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);
}
}
use of org.apache.commons.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);
}
}
use of org.apache.commons.pool2.impl.AbandonedConfig in project tomcat by apache.
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);
}
}
Aggregations