001package co.codewizards.cloudstore.ls.core.invoke.refjanitor;
002
003import co.codewizards.cloudstore.ls.core.invoke.ObjectManager;
004import co.codewizards.cloudstore.ls.core.invoke.filter.ExtMethodInvocationRequest;
005
006/**
007 * A {@code ReferenceJanitor}'s primary duty is to clean up references.
008 * <p>
009 * But it may manipulate a method invocation's arguments, too. Hence, it's not simply a "Cleaner" but
010 * more a "Janitor" having an advanced job ;-)
011 * <p>
012 * In order to do his work, he is notified about all method invocations. So he can track which references (primarily
013 * listeners) are registered where. Finally, he can clean the tangling references up, when an {@link ObjectManager} is evicted.
014 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co
015 */
016public interface ReferenceJanitor {
017
018        int getPriority();
019
020        void preInvoke(ExtMethodInvocationRequest extMethodInvocationRequest);
021
022        void postInvoke(ExtMethodInvocationRequest extMethodInvocationRequest, Object resultObject, Throwable error);
023
024        void cleanUp();
025
026}