public class AbandonedTrace
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AbandonedTrace.AbandonedObjectException |
Modifier and Type | Field and Description |
---|---|
private AbandonedConfig |
config
DBCP AbandonedConfig
|
private java.lang.Exception |
createdBy
A stack trace of the code that created me (if in debug mode)
|
private long |
lastUsed
Last time this connection was used
|
private java.util.List |
traceList
A list of objects created by children of this object
|
Constructor and 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.
|
Modifier and Type | Method and 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.
|
private void |
init(AbandonedTrace parent)
Initialize abandoned tracing for 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.
|
private final AbandonedConfig config
private volatile java.lang.Exception createdBy
private final java.util.List traceList
private volatile long lastUsed
public AbandonedTrace()
public AbandonedTrace(AbandonedConfig config)
config
- AbandonedConfigpublic AbandonedTrace(AbandonedTrace parent)
parent
- AbandonedTrace parent objectprivate void init(AbandonedTrace parent)
parent
- AbandonedTrace parent objectprotected AbandonedConfig getConfig()
protected long getLastUsed()
protected void setLastUsed()
protected void setLastUsed(long time)
time
- time in msprotected void setStackTrace()
protected void addTrace(AbandonedTrace trace)
trace
- AbandonedTrace object to addprotected void clearTrace()
protected java.util.List getTrace()
public void printStackTrace()
protected void removeTrace(AbandonedTrace trace)
trace
- AbandonedTrace object to remove