java.lang.ref.Reference

java.lang.ref.Reference<T>,java引用对象及垃圾收集器的工具类

こ雲淡風輕ζ 提交于 2019-12-01 03:58:08
等下会以英文源文档+翻译的方式来分析Reference这一个类。 约定对应的中文翻译对对应于正上面的英文或者代码,英文源文档直接对应于正上面的代码。 >类的定义 Abstract base class for reference objects. This class defines the operations common to all reference objects. Because reference objects are implemented in close cooperation with the garbage collector, this class may not be subclassed directly. 从JDK中文文档的翻译是: 引用对象的抽象基类。此类定义了常用于所有引用对象的操作。因为引用对象是通过与垃圾回收器的密切合作来实现的,所以不能直接为此类创建子类。 >private T referent; /* Treated specially by GC */ /* A Reference instance is in one of four possible internal states: * * Active: Subject to special treatment by the garbage collector. Some *