org.apache.commons.dbcp
Class AbandonedTrace

java.lang.Object
  extended by org.apache.commons.dbcp.AbandonedTrace
Direct Known Subclasses:
DelegatingConnection, DelegatingDatabaseMetaData, DelegatingResultSet, DelegatingStatement

public class AbandonedTrace
extends Object

Tracks db connection usage for recovering and reporting abandoned db connections. The JDBC Connection, Statement, and ResultSet classes extend this class.

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

Constructor Summary
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
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  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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 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


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