Record Class LeakReport

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.leak.LeakReport
Record Components:
name - the name of the leaked ClassLoader | 泄漏的 ClassLoader 名称
level - the detection level used | 使用的检测级别
creationStack - the stack trace at creation time, or empty array if level is SIMPLE | 创建时的栈轨迹,如果级别为 SIMPLE 则为空数组
loadedClassCount - the number of classes loaded at tracking time | 追踪时已加载的类数量
createdAtNanos - the creation timestamp in nanoseconds (System.nanoTime) | 创建时间戳(纳秒,System.nanoTime)

public record LeakReport(String name, LeakDetection level, StackTraceElement[] creationStack, int loadedClassCount, long createdAtNanos) extends Record
Immutable report of a detected ClassLoader leak 检测到的 ClassLoader 泄漏的不可变报告

Contains diagnostic information about a ClassLoader that was garbage-collected without being explicitly closed, indicating a potential resource leak.

包含未显式关闭就被垃圾回收的 ClassLoader 的诊断信息, 表明存在潜在的资源泄漏。

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是 (不可变记录)
Since:
JDK 25, opencode-base-classloader V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • LeakReport

      public LeakReport(String name, LeakDetection level, StackTraceElement[] creationStack, int loadedClassCount, long createdAtNanos)
      Compact constructor with validation 带验证的紧凑构造器
      Throws:
      NullPointerException - if name, level or creationStack is null | 当 name、level 或 creationStack 为 null 时
      IllegalArgumentException - if loadedClassCount is negative | 当 loadedClassCount 为负数时
  • Method Details

    • creationStack

      public StackTraceElement[] creationStack()
      Returns a defensive copy of the creation stack trace 返回创建栈轨迹的防御性副本
      Returns:
      copy of the creation stack trace | 创建栈轨迹的副本
    • toString

      public String toString()
      Format the leak report as a human-readable string 将泄漏报告格式化为人类可读的字符串
      Specified by:
      toString in class Record
      Returns:
      formatted report string | 格式化的报告字符串
    • equals

      public boolean equals(Object o)
      Custom equals that compares creationStack by content 自定义 equals,按内容比较 creationStack
      Specified by:
      equals in class Record
      Parameters:
      o - the object to compare | 要比较的对象
      Returns:
      true if equal | 如果相等返回 true
    • hashCode

      public int hashCode()
      Custom hashCode consistent with equals 与 equals 一致的自定义 hashCode
      Specified by:
      hashCode in class Record
      Returns:
      hash code | 哈希码
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • level

      public LeakDetection level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • loadedClassCount

      public int loadedClassCount()
      Returns the value of the loadedClassCount record component.
      Returns:
      the value of the loadedClassCount record component
    • createdAtNanos

      public long createdAtNanos()
      Returns the value of the createdAtNanos record component.
      Returns:
      the value of the createdAtNanos record component