TrackedUse (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.tomcat.dbcp.pool2, interface: TrackedUse

# Interface TrackedUse

All Known Implementing Classes:
  `AbandonedTrace, DelegatingCallableStatement, DelegatingConnection, DelegatingPreparedStatement, DelegatingResultSet, DelegatingStatement, ManagedConnection, PoolableCallableStatement, PoolableConnection, PoolableManagedConnection, PoolablePreparedStatement, PoolingConnection`

public interface TrackedUse
Allows pooled objects to make information available about when and how they were used available to the object pool. The object pool may, but is not required, to use this information to make more informed decisions when determining the state of a pooled object - for instance whether or not the object has been abandoned.

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getLastUsed()`
  Deprecated.
  Use `getLastUsedInstant()` which offers the best precision.
  `default Instant`
  `getLastUsedInstant()`
  Gets the last Instant this object was used.

- ## Method Details

  - ### getLastUsed

    @Deprecated long getLastUsed()
    Deprecated.
    Use `getLastUsedInstant()` which offers the best precision.
    Gets the last time this object was used in milliseconds.
    Returns:
      the last time this object was used in milliseconds.

  - ### getLastUsedInstant

    default Instant getLastUsedInstant()
    Gets the last Instant this object was used.

    Starting with Java 9, the JRE `SystemClock` precision is increased usually down to microseconds, or tenth of microseconds, depending on the OS, Hardware, and JVM implementation.

    Returns:
      the last Instant this object was used.
    Since:
      2.11.0