开发者

java store objects that may be garbage collected

In Java, I recall there is a way to store objects in a usable format that may be garbage collected. It is some sort of loose reference. If they get garbage collected there is a way to detect and reload.

I'm havi开发者_Python百科ng a hard time finding this. There is so much information about GC in general. Anyone know the name?


I believe you are looking for WeakReference


You're thinking of Weak References.


I think you're looking for the *Reference classes in java.lang.ref. The ReferenceQueue class allows you to be notified when a reference is collected.

You might also find FinalizableReference from Google Guava useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜