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 Details

    • TrackedObject

      public TrackedObject(PooledObject<T> pooledObject, Instant borrowTime, String threadName, StackTraceElement[] stackTrace)
      Creates an instance of a TrackedObject record class.
      Parameters:
      pooledObject - the value for the pooledObject record component
      borrowTime - the value for the borrowTime record component
      threadName - the value for the threadName record component
      stackTrace - the value for the stackTrace record component
  • Method Details

    • borrowDuration

      public Duration borrowDuration()
      Gets the duration since borrow. 获取自借用以来的时长。
      Returns:
      the duration - 时长
    • stackTraceString

      public String stackTraceString()
      Gets the stack trace as string. 获取调用栈字符串。
      Returns:
      the stack trace string or "N/A" - 调用栈字符串或"N/A"
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • pooledObject

      public PooledObject<T> pooledObject()
      Returns the value of the pooledObject record component.
      Returns:
      the value of the pooledObject record component
    • borrowTime

      public Instant borrowTime()
      Returns the value of the borrowTime record component.
      Returns:
      the value of the borrowTime record component
    • threadName

      public String threadName()
      Returns the value of the threadName record component.
      Returns:
      the value of the threadName record component
    • stackTrace

      public StackTraceElement[] stackTrace()
      Returns the value of the stackTrace record component.
      Returns:
      the value of the stackTrace record component