001package jmri;
002
003/**
004 * Interface that indicates that a class has a {@link #dispose()} method that
005 * can be called without arguments.
006 * <p>
007 * Notably, when classes with this method are removed from the
008 * {@link jmri.InstanceManager}, this method is called on those classes to allow
009 * them to take any required actions when removed from the InstanceManager.
010 * <p>
011 * There are no assurances this method will not be called multiple times.
012 *
013 * @author Randall Wood Copyright 2017
014 */
015public interface Disposable {
016
017    /**
018     * Called when disposing of a disposable.
019     * <p>
020     * <strong>Note</strong> there are no assurances this method will not be
021     * called multiple times against a single instance of this Disposable.
022     * It is the responsibility of this Disposable to protect itself and the
023     * application from ensuring that calling this method multiple times has no
024     * unwanted side effects.
025     */
026    void dispose();
027}