Package org.apache.tomcat.dbcp.dbcp2
Class AbandonedTrace
- java.lang.Object
- 
- org.apache.tomcat.dbcp.dbcp2.AbandonedTrace
 
- 
- All Implemented Interfaces:
- java.lang.AutoCloseable,- TrackedUse
 - Direct Known Subclasses:
- DelegatingConnection,- DelegatingResultSet,- DelegatingStatement
 
 public class AbandonedTrace extends java.lang.Object implements TrackedUse, java.lang.AutoCloseable Tracks connection usage for recovering and reporting abandoned connections.The JDBC Connection, Statement, and ResultSet classes extend this class. - Since:
- 2.0
 
- 
- 
Constructor SummaryConstructors Constructor Description AbandonedTrace()Creates a new AbandonedTrace without config and without doing abandoned tracing.AbandonedTrace(AbandonedTrace parent)Constructs a new AbandonedTrace with a parent object.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddTrace(AbandonedTrace trace)Adds an object to the list of objects being traced.protected voidclearTrace()Clears the list of objects being traced by this object.voidclose()Subclasses can implement this nop.protected voidclose(java.util.function.Consumer<java.lang.Exception> exceptionHandler)Closes this resource and if an exception is caught, then callsexceptionHandler.longgetLastUsed()Deprecated.java.time.InstantgetLastUsedInstant()Gets the last Instant this object was used.protected java.util.List<AbandonedTrace>getTrace()Gets a list of objects being traced by this object.protected voidremoveThisTrace(java.lang.Object source)Removes this object the source object is tracing.protected voidremoveTrace(AbandonedTrace trace)Removes a child object this object is tracing.protected voidsetLastUsed()Sets the time this object was last used to the current time in milliseconds.protected voidsetLastUsed(long lastUsedMillis)Deprecated.protected voidsetLastUsed(java.time.Instant lastUsedInstant)Sets the instant this object was last used.
 
- 
- 
- 
Constructor Detail- 
AbandonedTracepublic AbandonedTrace() Creates a new AbandonedTrace without config and without doing abandoned tracing.
 - 
AbandonedTracepublic AbandonedTrace(AbandonedTrace parent) Constructs a new AbandonedTrace with a parent object.- Parameters:
- parent- AbandonedTrace parent object.
 
 
- 
 - 
Method Detail- 
addTraceprotected void addTrace(AbandonedTrace trace) Adds an object to the list of objects being traced.- Parameters:
- trace- AbandonedTrace object to add.
 
 - 
clearTraceprotected void clearTrace() Clears the list of objects being traced by this object.
 - 
closepublic void close() throws java.sql.SQLExceptionSubclasses can implement this nop.- Specified by:
- closein interface- java.lang.AutoCloseable
- Throws:
- java.sql.SQLException- Ignored here, for subclasses.
- Since:
- 2.10.0
 
 - 
closeprotected void close(java.util.function.Consumer<java.lang.Exception> exceptionHandler) Closes this resource and if an exception is caught, then callsexceptionHandler.- Parameters:
- exceptionHandler- Consumes exception thrown closing this resource.
- Since:
- 2.10.0
 
 - 
getLastUsed@Deprecated public long getLastUsed() Deprecated.Gets the last time this object was used in milliseconds.- Specified by:
- getLastUsedin interface- TrackedUse
- Returns:
- long time in milliseconds.
 
 - 
getLastUsedInstantpublic java.time.Instant getLastUsedInstant() Description copied from interface:TrackedUseGets the last Instant this object was used.Starting with Java 9, the JRE SystemClockprecision is increased usually down to microseconds, or tenth of microseconds, depending on the OS, Hardware, and JVM implementation.- Specified by:
- getLastUsedInstantin interface- TrackedUse
- Returns:
- the last Instant this object was used.
 
 - 
getTraceprotected java.util.List<AbandonedTrace> getTrace() Gets a list of objects being traced by this object.- Returns:
- List of objects.
 
 - 
removeThisTraceprotected void removeThisTrace(java.lang.Object source) Removes this object the source object is tracing.- Parameters:
- source- The object tracing
- Since:
- 2.7.0
 
 - 
removeTraceprotected void removeTrace(AbandonedTrace trace) Removes a child object this object is tracing.- Parameters:
- trace- AbandonedTrace object to remove.
 
 - 
setLastUsedprotected void setLastUsed() Sets the time this object was last used to the current time in milliseconds.
 - 
setLastUsedprotected void setLastUsed(java.time.Instant lastUsedInstant) Sets the instant this object was last used.- Parameters:
- lastUsedInstant- instant.
- Since:
- 2.10.0
 
 - 
setLastUsed@Deprecated protected void setLastUsed(long lastUsedMillis) Deprecated.Sets the time in milliseconds this object was last used.- Parameters:
- lastUsedMillis- time in milliseconds.
 
 
- 
 
-