org.apache.commons.dbcp2

## Class AbandonedTrace

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

- All Implemented Interfaces:
    org.apache.commons.pool2.TrackedUse
  Direct Known Subclasses:
    DelegatingConnection, DelegatingResultSet, DelegatingStatement

      public class AbandonedTrace
      extends Object
      implements org.apache.commons.pool2.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
  Version:
    $Revision: 1572242 $ $Date: 2014-02-26 20:34:39 +0000 (Wed, 26 Feb 2014) $
  Author:
    Glenn L. Nielsen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbandonedTrace()` Create a new AbandonedTrace without config and without doing abandoned tracing.
    `AbandonedTrace(AbandonedTrace parent)` Construct a new AbandonedTrace with a parent object.

  - ### Method Summary

    Methods
    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.
    `long` | `getLastUsed()` Get the last time this object was used in ms.
    `protected List<AbandonedTrace>` | `getTrace()` Get a list of objects being traced by 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.

    - ### 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(AbandonedTrace parent)

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

  - ### Method Detail

    - #### getLastUsed

          public long getLastUsed()

      Get the last time this object was used in ms.
      Specified by:
        `getLastUsed` in interface `org.apache.commons.pool2.TrackedUse`
      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

    - #### 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<AbandonedTrace> getTrace()

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

    - #### removeTrace

          protected void removeTrace(AbandonedTrace trace)

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

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