/** * Register an {@link AutoReferenceCounted} instance to be cleaned up by this * {@code AutoReferenceCountedReaper} when the {@link AutoReferenceCounted} is determined by * the JVM to no longer be reachable. * * @param autoReferenceCountable to be registered to this reaper. */ public void registerAutoReferenceCounted(AutoReferenceCounted autoReferenceCountable) { Preconditions.checkState(mIsOpen, "cannot register an AutoReferenceCounted to a closed AutoReferenceCountedReaper."); LOG.debug("Registering AutoReferenceCounted {}.", autoReferenceCountable); mReferences.add( new CloseablePhantomRef( autoReferenceCountable, mReferenceQueue, autoReferenceCountable.getCloseableResources()) ); }