001    /* 
002        Licensed to the Apache Software Foundation (ASF) under one
003        or more contributor license agreements.  See the NOTICE file
004        distributed with this work for additional information
005        regarding copyright ownership.  The ASF licenses this file
006        to you under the Apache License, Version 2.0 (the
007        "License"); you may not use this file except in compliance
008        with the License.  You may obtain a copy of the License at
009    
010           http://www.apache.org/licenses/LICENSE-2.0
011    
012        Unless required by applicable law or agreed to in writing,
013        software distributed under the License is distributed on an
014        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015        KIND, either express or implied.  See the License for the
016        specific language governing permissions and limitations
017        under the License.  
018     */
019    package org.apache.wiki;
020    
021    
022    /**
023     *  A watchdog needs something to watch.  If you wish to be watched, implement this interface.
024     */
025    public interface Watchable {
026    
027        /**
028         *  This is a callback which is called whenever your expected completion time is exceeded.  The current state of the
029         *  stack is available.
030         *
031         *  @param state The state in which your Watchable is currently.
032         */
033        void timeoutExceeded( String state );
034    
035        /**
036         *  Returns a human-readable name of this Watchable.  Used in logging.
037         *
038         *  @return The name of the Watchable.
039         */
040        String getName();
041    
042        /**
043         *  Returns <code>true</code>, if this Watchable is still alive and can be watched; otherwise <code>false</code>. 
044         *  For example, a stopped Thread is not very interesting to watch.
045         *
046         *  @return the result
047         */
048        boolean isAlive();
049    
050    }