Package org.apache.commons.dbcp
Class AbandonedTrace
- java.lang.Object
-
- org.apache.commons.dbcp.AbandonedTrace
-
- Direct Known Subclasses:
DelegatingConnection
,DelegatingDatabaseMetaData
,DelegatingResultSet
,DelegatingStatement
public class AbandonedTrace extends java.lang.Object
Tracks db connection usage for recovering and reporting abandoned db connections. The JDBC Connection, Statement, and ResultSet classes extend this class.- Version:
- $Revision: 899987 $ $Date: 2010-01-16 11:51:16 -0500 (Sat, 16 Jan 2010) $
- Author:
- Glenn L. Nielsen
-
-
Constructor Summary
Constructors Constructor Description AbandonedTrace()
Create a new AbandonedTrace without config and without doing abandoned tracing.AbandonedTrace(AbandonedConfig config)
Construct a new AbandonedTrace with no parent object.AbandonedTrace(AbandonedTrace parent)
Construct a new AbandonedTrace with a parent object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTrace(AbandonedTrace trace)
Add an object to the list of objects being traced.protected void
clearTrace()
Clear the list of objects being traced by this object.protected AbandonedConfig
getConfig()
Get the abandoned config for this object.protected long
getLastUsed()
Get the last time this object was used in ms.protected java.util.List
getTrace()
Get a list of objects being traced by this object.void
printStackTrace()
Prints a stack trace of the code that created this object.protected void
removeTrace(AbandonedTrace trace)
Remove a child object this object is tracing.protected void
setLastUsed()
Set the time this object was last used to the current time in ms.protected void
setLastUsed(long time)
Set the time in ms this object was last used.protected void
setStackTrace()
If logAbandoned=true generate a stack trace for this object then add this object to the parent object trace list.
-
-
-
Constructor Detail
-
AbandonedTrace
public AbandonedTrace()
Create a new AbandonedTrace without config and without doing abandoned tracing.
-
AbandonedTrace
public AbandonedTrace(AbandonedConfig config)
Construct a new AbandonedTrace with no parent object.- Parameters:
config
- AbandonedConfig
-
AbandonedTrace
public AbandonedTrace(AbandonedTrace parent)
Construct a new AbandonedTrace with a parent object.- Parameters:
parent
- AbandonedTrace parent object
-
-
Method Detail
-
getConfig
protected AbandonedConfig getConfig()
Get the abandoned config for this object.- Returns:
- AbandonedConfig for this object
-
getLastUsed
protected long getLastUsed()
Get the last time this object was used in ms.- Returns:
- long time in ms
-
setLastUsed
protected void setLastUsed()
Set the time this object was last used to the current time in ms.
-
setLastUsed
protected void setLastUsed(long time)
Set the time in ms this object was last used.- Parameters:
time
- time in ms
-
setStackTrace
protected void setStackTrace()
If logAbandoned=true generate a stack trace for this object then add this object to the parent object trace list.
-
addTrace
protected void addTrace(AbandonedTrace trace)
Add an object to the list of objects being traced.- Parameters:
trace
- AbandonedTrace object to add
-
clearTrace
protected void clearTrace()
Clear the list of objects being traced by this object.
-
getTrace
protected java.util.List getTrace()
Get a list of objects being traced by this object.- Returns:
- List of objects
-
printStackTrace
public void printStackTrace()
Prints a stack trace of the code that created this object.
-
removeTrace
protected void removeTrace(AbandonedTrace trace)
Remove a child object this object is tracing.- Parameters:
trace
- AbandonedTrace object to remove
-
-