org.apache.commons.dbcp
Class AbandonedConfig

java.lang.Object
  extended by org.apache.commons.dbcp.AbandonedConfig

public class AbandonedConfig
extends Object

Configuration settings for handling abandoned db connections.

Version:
$Revision: 892307 $ $Date: 2013-12-31 23:27:28 +0000 (Tue, 31 Dec 2013) $
Author:
Glenn L. Nielsen

Constructor Summary
AbandonedConfig()
           
 
Method Summary
 boolean getLogAbandoned()
          Flag to log stack traces for application code which abandoned a Statement or Connection.
 PrintWriter getLogWriter()
          Returns the log writer being used by this configuration to log information on abandoned objects.
 boolean getRemoveAbandoned()
          Flag to remove abandoned connections if they exceed the removeAbandonedTimeout.
 int getRemoveAbandonedTimeout()
          Timeout in seconds before an abandoned connection can be removed.
 void setLogAbandoned(boolean logAbandoned)
          Flag to log stack traces for application code which abandoned a Statement or Connection.
 void setLogWriter(PrintWriter logWriter)
          Sets the log writer to be used by this configuration to log information on abandoned objects.
 void setRemoveAbandoned(boolean removeAbandoned)
          Flag to remove abandoned connections if they exceed the removeAbandonedTimeout.
 void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
          Timeout in seconds before an abandoned connection can be removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbandonedConfig

public AbandonedConfig()
Method Detail

getRemoveAbandoned

public boolean getRemoveAbandoned()
Flag to remove abandoned connections if they exceed the removeAbandonedTimeout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.

Returns:
true if abandoned connections are to be removed

setRemoveAbandoned

public void setRemoveAbandoned(boolean removeAbandoned)
Flag to remove abandoned connections if they exceed the removeAbandonedTimeout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.

Parameters:
removeAbandoned - true means abandoned connections will be removed

getRemoveAbandonedTimeout

public int getRemoveAbandonedTimeout()
Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds.

Returns:
abandoned timeout in seconds

setRemoveAbandonedTimeout

public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds.

Parameters:
removeAbandonedTimeout - abandoned timeout in seconds

getLogAbandoned

public boolean getLogAbandoned()
Flag to log stack traces for application code which abandoned a Statement or Connection. Defaults to false. Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.

Returns:
boolean true if stack trace logging is turned on for abandoned Statements or Connections

setLogAbandoned

public void setLogAbandoned(boolean logAbandoned)
Flag to log stack traces for application code which abandoned a Statement or Connection. Defaults to false. Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.

Parameters:
logAbandoned - true turns on abandoned stack trace logging

getLogWriter

public PrintWriter getLogWriter()
Returns the log writer being used by this configuration to log information on abandoned objects. If not set, a PrintWriter based on System.out is used.

Returns:
log writer in use

setLogWriter

public void setLogWriter(PrintWriter logWriter)
Sets the log writer to be used by this configuration to log information on abandoned objects.

Parameters:
logWriter - The new log writer


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.