common_helper/src/main/java/com/xiongyingqi/util/WeakReferenceMonitor.java
private static void addEntry(Reference<?> ref, ReleaseListener entry) {
        synchronized (WeakReferenceMonitor.class) {
            // Add entry, the key is given reference.
            trackedEntries.put(ref, entry);

            // Start monitoring thread lazily.
            if (monitoringThread == null) {
                monitoringThread = new Thread(new MonitoringProcess(), WeakReferenceMonitor.class.getName());
                monitoringThread.setDaemon(true);
                monitoringThread.start();
            }
        }
    }
private static void addEntry(Reference<?> ref, ReleaseListener entry) {
        synchronized (WeakReferenceMonitor.class) {
            // Add entry, the key is given reference.
            trackedEntries.put(ref, entry);

            // Start monitoring thread lazily.
            if (monitoringThread == null) {
                monitoringThread = new Thread(new MonitoringProcess(), WeakReferenceMonitor.class.getName());
                monitoringThread.setDaemon(true);
                monitoringThread.start();
            }
        }
    }
private static void addEntry ( Reference < ? > ref , ReleaseListener entry ) { synchronized ( WeakReferenceMonitor . class ) { // Add entry, the key is given reference. trackedEntries . put ( ref , entry ) ; // Start monitoring thread lazily. if ( monitoringThread == null ) { monitoringThread = new Thread ( new MonitoringProcess ( ) , WeakReferenceMonitor . class . getName ( ) ) ; monitoringThread . setDaemon ( true ) ; monitoringThread . start ( ) ; } } }
Add entry to internal map of tracked entries.
Internal monitoring thread is started if not already running.

@param ref   reference to tracked handle
@param entry the associated entry
Add entry to internal map of tracked entries . Internal monitoring thread is started if not already running .