Record Class PooledObjectTracker.TrackedObject<T>
java.lang.Object
java.lang.Record
cloud.opencode.base.pool.tracker.PooledObjectTracker.TrackedObject<T>
- Type Parameters:
T- the object type - 对象类型- Record Components:
pooledObject- the pooled object - 池化对象borrowTime- the borrow time - 借用时间threadName- the borrowing thread name - 借用线程名称stackTrace- the borrow stack trace (may be null) - 借用调用栈(可能为null)
- Enclosing class:
PooledObjectTracker<T>
public static record PooledObjectTracker.TrackedObject<T>(PooledObject<T> pooledObject, Instant borrowTime, String threadName, StackTraceElement[] stackTrace)
extends Record
Tracked object information.
追踪对象信息。
- Since:
- JDK 25, opencode-base-pool V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionTrackedObject(PooledObject<T> pooledObject, Instant borrowTime, String threadName, StackTraceElement[] stackTrace) Creates an instance of aTrackedObjectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionGets the duration since borrow.Returns the value of theborrowTimerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thepooledObjectrecord component.Returns the value of thestackTracerecord component.Gets the stack trace as string.Returns the value of thethreadNamerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TrackedObject
public TrackedObject(PooledObject<T> pooledObject, Instant borrowTime, String threadName, StackTraceElement[] stackTrace) Creates an instance of aTrackedObjectrecord class.- Parameters:
pooledObject- the value for thepooledObjectrecord componentborrowTime- the value for theborrowTimerecord componentthreadName- the value for thethreadNamerecord componentstackTrace- the value for thestackTracerecord component
-
-
Method Details
-
borrowDuration
Gets the duration since borrow. 获取自借用以来的时长。- Returns:
- the duration - 时长
-
stackTraceString
Gets the stack trace as string. 获取调用栈字符串。- Returns:
- the stack trace string or "N/A" - 调用栈字符串或"N/A"
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
pooledObject
Returns the value of thepooledObjectrecord component.- Returns:
- the value of the
pooledObjectrecord component
-
borrowTime
Returns the value of theborrowTimerecord component.- Returns:
- the value of the
borrowTimerecord component
-
threadName
Returns the value of thethreadNamerecord component.- Returns:
- the value of the
threadNamerecord component
-
stackTrace
Returns the value of thestackTracerecord component.- Returns:
- the value of the
stackTracerecord component
-