DefaultPooledObjectInfo (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.tomcat.dbcp.pool2.impl, class: DefaultPooledObjectInfo

# Class DefaultPooledObjectInfo

java.lang.Object
org.apache.tomcat.dbcp.pool2.impl.DefaultPooledObjectInfo

All Implemented Interfaces:
  `DefaultPooledObjectInfoMBean`

public class DefaultPooledObjectInfo extends Object implements DefaultPooledObjectInfoMBean
Implements providing information on pooled objects via JMX.

Since:
  2.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultPooledObjectInfo(PooledObject<?> pooledObject)`
  Constructs a new instance for the given pooled object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getBorrowedCount()`
  Gets the number of times this object has been borrowed.
  `long`
  `getCreateTime()`
  Gets the time (using the same basis as `Clock.instant()`) that pooled object was created.
  `String`
  `getCreateTimeFormatted()`
  Gets the time that pooled object was created.
  `long`
  `getLastBorrowTime()`
  Gets the time (using the same basis as `Clock.instant()`) the polled object was last borrowed.
  `String`
  `getLastBorrowTimeFormatted()`
  Gets the time that pooled object was last borrowed.
  `String`
  `getLastBorrowTrace()`
  Gets the stack trace recorded when the pooled object was last borrowed.
  `long`
  `getLastReturnTime()`
  Gets the time (using the same basis as `Clock.instant()`)the wrapped object was last returned.
  `String`
  `getLastReturnTimeFormatted()`
  Gets the time that pooled object was last returned.
  `String`
  `getPooledObjectToString()`
  Gets a String form of the wrapper for debug purposes.
  `String`
  `getPooledObjectType()`
  Gets the name of the class of the pooled object.
  `String`
  `toString()`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### DefaultPooledObjectInfo

    public DefaultPooledObjectInfo(PooledObject<?> pooledObject)
    Constructs a new instance for the given pooled object.
    Parameters:
      `pooledObject` - The pooled object that this instance will represent
    Throws:
      `NullPointerException` - if `obj` is `null`

- ## Method Details

  - ### getBorrowedCount

    public long getBorrowedCount()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the number of times this object has been borrowed.
    Specified by:
      `getBorrowedCount` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The number of times this object has been borrowed.

  - ### getCreateTime

    public long getCreateTime()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time (using the same basis as `Clock.instant()`) that pooled object was created.
    Specified by:
      `getCreateTime` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The creation time for the pooled object.

  - ### getCreateTimeFormatted

    public String getCreateTimeFormatted()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time that pooled object was created.
    Specified by:
      `getCreateTimeFormatted` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The creation time for the pooled object formatted as `yyyy-MM-dd HH:mm:ss Z`.

  - ### getLastBorrowTime

    public long getLastBorrowTime()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time (using the same basis as `Clock.instant()`) the polled object was last borrowed.
    Specified by:
      `getLastBorrowTime` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The time the pooled object was last borrowed.

  - ### getLastBorrowTimeFormatted

    public String getLastBorrowTimeFormatted()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time that pooled object was last borrowed.
    Specified by:
      `getLastBorrowTimeFormatted` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The last borrowed time for the pooled object formatted as `yyyy-MM-dd HH:mm:ss Z`.

  - ### getLastBorrowTrace

    public String getLastBorrowTrace()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the stack trace recorded when the pooled object was last borrowed.
    Specified by:
      `getLastBorrowTrace` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The stack trace showing which code last borrowed the pooled object.

  - ### getLastReturnTime

    public long getLastReturnTime()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time (using the same basis as `Clock.instant()`)the wrapped object was last returned.
    Specified by:
      `getLastReturnTime` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The time the object was last returned.

  - ### getLastReturnTimeFormatted

    public String getLastReturnTimeFormatted()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the time that pooled object was last returned.
    Specified by:
      `getLastReturnTimeFormatted` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The last returned time for the pooled object formatted as `yyyy-MM-dd HH:mm:ss Z`.

  - ### getPooledObjectToString

    public String getPooledObjectToString()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets a String form of the wrapper for debug purposes. The format is not fixed and may change at any time.
    Specified by:
      `getPooledObjectToString` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      A string representation of the pooled object.
    See Also:
      - `Object.toString()`

  - ### getPooledObjectType

    public String getPooledObjectType()
    Description copied from interface: `DefaultPooledObjectInfoMBean`
    Gets the name of the class of the pooled object.
    Specified by:
      `getPooledObjectType` in interface `DefaultPooledObjectInfoMBean`
    Returns:
      The pooled object's class name.
    See Also:
      - `Class.getName()`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`
    Since:
      2.4.3