View Javadoc

1   // Copyright (C) 2005 - 2008 Philip Aston
2   // All rights reserved.
3   //
4   // This file is part of The Grinder software distribution. Refer to
5   // the file LICENSE which is part of The Grinder distribution for
6   // licensing details. The Grinder distribution is available on the
7   // Internet at http://grinder.sourceforge.net/
8   //
9   // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
12  // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
13  // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
14  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
15  // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
16  // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
17  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
18  // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19  // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
20  // OF THE POSSIBILITY OF SUCH DAMAGE.
21  
22  package net.grinder.console.distribution;
23  
24  import java.beans.PropertyChangeListener;
25  
26  
27  /**
28   * Simplistic model of remote file caches.
29   *
30   * <p>
31   * This tracks the state of all the caches, so {@link #getOutOfDate()} will
32   * return <code>true</code> if any one of the caches is out of date. For per
33   * cache information, see {@link AgentSet#getAddressOfOutOfDateAgents}.
34   * </p>
35   *
36   * @author Philip Aston
37   */
38  public interface AgentCacheState {
39  
40    /**
41     * Enquire whether one or more agent caches is out of date.
42     *
43     * @return <code>true</code> => at least one agent cache is out of date.
44     */
45    boolean getOutOfDate();
46  
47    /**
48     * Inform that agent caches are out of date due to a change to a file. Called
49     * whenever a new or modified file is found.
50     *
51     * @param time
52     *            Caches need to be refreshed with files newer than this time
53     *            (milliseconds since Epoch).
54     */
55    void setNewFileTime(long time);
56  
57    /**
58     * Allow other parties to register their interest in changes to our state.
59     *
60     * @param listener Listener to notify on a state change.
61     */
62    void addListener(PropertyChangeListener listener);
63  }