org.apache.commons.dbcp2

## Class AbandonedTrace

- java.lang.Object
- - org.apache.commons.dbcp2.AbandonedTrace

- All Implemented Interfaces:
    TrackedUse
  Direct Known Subclasses:
    DelegatingConnection, DelegatingResultSet, DelegatingStatement

      public class AbandonedTrace
      extends Object
      implements TrackedUse

  Tracks db connection usage for recovering and reporting abandoned db connections.

  The JDBC Connection, Statement, and ResultSet classes extend this class.

  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and 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 Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addTrace(AbandonedTrace trace)` Adds an object to the list of objects being traced.
    `protected void` | `clearTrace()` Clears the list of objects being traced by this object.
    `long` | `getLastUsed()` Gets the last time this object was used in milliseconds.
    `protected List<AbandonedTrace>` | `getTrace()` Gets a list of objects being traced by this object.
    `protected void` | `removeTrace(AbandonedTrace trace)` Removes a child object this object is tracing.
    `protected void` | `setLastUsed()` Sets the time this object was last used to the current time in milliseconds.
    `protected void` | `setLastUsed(long lastUsedMillis)` Sets the time in milliseconds this object was last used.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbandonedTrace

          public AbandonedTrace()

      Creates a new AbandonedTrace without config and without doing abandoned tracing.

    - #### AbandonedTrace

          public AbandonedTrace(AbandonedTrace parent)

      Constructs a new AbandonedTrace with a parent object.
      Parameters:
        `parent` - AbandonedTrace parent object.

  - ### Method Detail

    - #### getLastUsed

          public long getLastUsed()

      Gets the last time this object was used in milliseconds.
      Specified by:
        `getLastUsed` in interface `TrackedUse`
      Returns:
        long time in milliseconds.

    - #### setLastUsed

          protected void setLastUsed()

      Sets the time this object was last used to the current time in milliseconds.

    - #### setLastUsed

          protected void setLastUsed(long lastUsedMillis)

      Sets the time in milliseconds this object was last used.
      Parameters:
        `lastUsedMillis` - time in milliseconds.

    - #### addTrace

          protected void addTrace(AbandonedTrace trace)

      Adds an object to the list of objects being traced.
      Parameters:
        `trace` - AbandonedTrace object to add.

    - #### clearTrace

          protected void clearTrace()

      Clears the list of objects being traced by this object.

    - #### getTrace

          protected List<AbandonedTrace> getTrace()

      Gets a list of objects being traced by this object.
      Returns:
        List of objects.

    - #### removeTrace

          protected void removeTrace(AbandonedTrace trace)

      Removes a child object this object is tracing.
      Parameters:
        `trace` - AbandonedTrace object to remove.

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.