类 WeakReferenceMonitor
- java.lang.Object
- org.springframework.util.WeakReferenceMonitor
@Deprecated public class WeakReferenceMonitor extends Object
已过时。as of Spring Framework 4.3.6Track references to arbitrary objects using proxy and weak references. To monitor a handle, one should callmonitor(Object, ReleaseListener)
, with the given handle object usually being a holder that uses the target object underneath, and the release listener performing cleanup of the target object once the handle is not strongly referenced anymore.When a given handle becomes weakly reachable, the specified listener will be called by a background thread. This thread will only be started lazily and will be stopped once no handles are registered for monitoring anymore, to be restarted if further handles are added.
Thanks to Tomasz Wysocki for the suggestion and the original implementation of this class!
- 从以下版本开始:
- 1.2
- 作者:
- Colin Sampaleanu, Juergen Hoeller
- 另请参阅:
monitor(java.lang.Object, org.springframework.util.WeakReferenceMonitor.ReleaseListener)
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
WeakReferenceMonitor.ReleaseListener
已过时。Listener that is notified when the handle is being released.
构造器概要
构造器 构造器 说明 WeakReferenceMonitor()
已过时。
构造器详细资料
WeakReferenceMonitor
public WeakReferenceMonitor()
已过时。
方法详细资料
monitor
public static void monitor(Object handle, WeakReferenceMonitor.ReleaseListener listener)
已过时。Start to monitor given handle object for becoming weakly reachable. When the handle isn't used anymore, the given listener will be called.- 参数:
handle
- the object that will be monitoredlistener
- the listener that will be called upon release of the handle