
sprouts.impl.ChangeListenerCleaner Maven / Gradle / Ivy
package sprouts.impl;
import org.jspecify.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;
import java.util.List;
/**
* This class stores actions which are being executed when an associated object is being garbage collected.
* This class is similar to the cleaner class introduced in JDK 11, however the minimal version compatibility target
* for Sprouts is Java 8, which means that this cleaner class introduced in Java 11 is not available here!
* That is why a custom cleaner implementation is needed.
*
* Warning: This is an internal class, meaning it should not be used
* anywhere but within this library.
* This class or its public methods might change or get removed in future versions!
*/
final class ChangeListenerCleaner
{
private static final Logger log = LoggerFactory.getLogger(ChangeListenerCleaner.class);
private static final ChangeListenerCleaner _INSTANCE = new ChangeListenerCleaner();
private static final long _QUEUE_TIMEOUT = 60 * 1000;
public static ChangeListenerCleaner getInstance() {
return _INSTANCE;
}
private final ReferenceQueue
© 2015 - 2025 Weber Informatics LLC | Privacy Policy