Lazy
class has a .clear()
method. When called, the reference held in the Lazy Reference is removed and only the ID is kept so that the instance can be reloaded when needed.WeakReference
. In short, if an instance is only referenced as "weak," the JVM GC will still clean it up.Lazy
instance has a lastTouched
timestamp. Each .get()
call sets it to the current time. This will tell you how long a Lazy Reference has not been used, i.e. if it is needed at all.LazyReferenceManager
audits this. It is enabled by default, with a timeout of 1,000,000 milliseconds, which is about 15 minutes.