public PhantomReference < T > register ( T object , Action0 leakCallback ) { PhantomReference < T > ref = new PhantomReference <> ( object , referenceQueue ) ; registeredMap . put ( ref , leakCallback ) ; return ref ; }
Register a tracked object . When the tracked object is released you must call the clear method of the LeakDetector .