Class DefaultPooledObjectInfo
- java.lang.Object
-
- org.apache.tomcat.dbcp.pool2.impl.DefaultPooledObjectInfo
-
- All Implemented Interfaces:
DefaultPooledObjectInfoMBean
public class DefaultPooledObjectInfo extends java.lang.Object implements DefaultPooledObjectInfoMBean
Implementation of object that is used to provide information on pooled objects via JMX.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description DefaultPooledObjectInfo(PooledObject<?> pooledObject)
Create a new instance for the given pooled object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBorrowedCount()
Get the number of times this object has been borrowed.long
getCreateTime()
Obtain the time (using the same basis asSystem.currentTimeMillis()
) that pooled object was created.java.lang.String
getCreateTimeFormatted()
Obtain the time that pooled object was created.long
getLastBorrowTime()
Obtain the time (using the same basis asSystem.currentTimeMillis()
) the polled object was last borrowed.java.lang.String
getLastBorrowTimeFormatted()
Obtain the time that pooled object was last borrowed.java.lang.String
getLastBorrowTrace()
Obtain the stack trace recorded when the pooled object was last borrowed.long
getLastReturnTime()
Obtain the time (using the same basis asSystem.currentTimeMillis()
)the wrapped object was last returned.java.lang.String
getLastReturnTimeFormatted()
Obtain the time that pooled object was last returned.java.lang.String
getPooledObjectToString()
Provides a String form of the wrapper for debug purposes.java.lang.String
getPooledObjectType()
Obtain the name of the class of the pooled object.java.lang.String
toString()
-
-
-
Constructor Detail
-
DefaultPooledObjectInfo
public DefaultPooledObjectInfo(PooledObject<?> pooledObject)
Create a new instance for the given pooled object.- Parameters:
pooledObject
- The pooled object that this instance will represent
-
-
Method Detail
-
getCreateTime
public long getCreateTime()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the time (using the same basis asSystem.currentTimeMillis()
) that pooled object was created.- Specified by:
getCreateTime
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The creation time for the pooled object
-
getCreateTimeFormatted
public java.lang.String getCreateTimeFormatted()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the time that pooled object was created.- Specified by:
getCreateTimeFormatted
in interfaceDefaultPooledObjectInfoMBean
- 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
Obtain the time (using the same basis asSystem.currentTimeMillis()
) the polled object was last borrowed.- Specified by:
getLastBorrowTime
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The time the pooled object was last borrowed
-
getLastBorrowTimeFormatted
public java.lang.String getLastBorrowTimeFormatted()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the time that pooled object was last borrowed.- Specified by:
getLastBorrowTimeFormatted
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The last borrowed time for the pooled object formatted as
yyyy-MM-dd HH:mm:ss Z
-
getLastBorrowTrace
public java.lang.String getLastBorrowTrace()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the stack trace recorded when the pooled object was last borrowed.- Specified by:
getLastBorrowTrace
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The stack trace showing which code last borrowed the pooled object
-
getLastReturnTime
public long getLastReturnTime()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the time (using the same basis asSystem.currentTimeMillis()
)the wrapped object was last returned.- Specified by:
getLastReturnTime
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The time the object was last returned
-
getLastReturnTimeFormatted
public java.lang.String getLastReturnTimeFormatted()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the time that pooled object was last returned.- Specified by:
getLastReturnTimeFormatted
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The last returned time for the pooled object formatted as
yyyy-MM-dd HH:mm:ss Z
-
getPooledObjectType
public java.lang.String getPooledObjectType()
Description copied from interface:DefaultPooledObjectInfoMBean
Obtain the name of the class of the pooled object.- Specified by:
getPooledObjectType
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The pooled object's class name
- See Also:
Class.getName()
-
getPooledObjectToString
public java.lang.String getPooledObjectToString()
Description copied from interface:DefaultPooledObjectInfoMBean
Provides a String form of the wrapper for debug purposes. The format is not fixed and may change at any time.- Specified by:
getPooledObjectToString
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- A string representation of the pooled object
- See Also:
Object.toString()
-
getBorrowedCount
public long getBorrowedCount()
Description copied from interface:DefaultPooledObjectInfoMBean
Get the number of times this object has been borrowed.- Specified by:
getBorrowedCount
in interfaceDefaultPooledObjectInfoMBean
- Returns:
- The number of times this object has been borrowed.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Since:
- 2.4.3
-
-