001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one or more
003 *  contributor license agreements.  See the NOTICE file distributed with
004 *  this work for additional information regarding copyright ownership.
005 *  The ASF licenses this file to You under the Apache License, Version 2.0
006 *  (the "License"); you may not use this file except in compliance with
007 *  the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 *  Unless required by applicable law or agreed to in writing, software
012 *  distributed under the License is distributed on an "AS IS" BASIS,
013 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 *  See the License for the specific language governing permissions and
015 *  limitations under the License.
016 */
017
018package org.apache.commons.daemon;
019
020/**
021 * Defines methods needed by the DaemonLoader.
022 */
023public interface DaemonController
024{
025
026    /**
027     * Shuts down the daemon.
028     *
029     * @throws IllegalStateException If the daemon is not in a valid state to be
030     *                               shutdown
031     */
032    void shutdown()
033        throws IllegalStateException;
034
035    /**
036     * Reloads daemon
037     *
038     * @throws IllegalStateException If the daemon is not in a valid state to be
039     *                               reloaded
040     */
041    void reload()
042        throws IllegalStateException;
043
044    /**
045     * Shuts down daemon and logs failed message.
046     *
047     * @throws IllegalStateException If the daemon is not in a valid state to be
048     *                               shutdown
049     */
050    void fail()
051        throws IllegalStateException;
052
053    /**
054     * Shuts down daemon and logs failed message.
055     *
056     * @param   message The message to log
057     *
058     * @throws IllegalStateException If the daemon is not in a valid state to be
059     *                               shutdown
060     */
061    void fail(String message)
062        throws IllegalStateException;
063
064    /**
065     * Shuts down daemon and logs failed message.
066     *
067     * @param   exception   The exception to log
068     *
069     * @throws IllegalStateException If the daemon is not in a valid state to be
070     *                               shutdown
071     */
072    void fail(Exception exception)
073        throws IllegalStateException;
074
075    /**
076     * Shuts down daemon and logs failed message.
077     *
078     * @param   message     The message to log
079     * @param   exception   The exception to log
080     *
081     * @throws IllegalStateException If the daemon is not in a valid state to be
082     *                               shutdown
083     */
084    void fail(String message, Exception exception)
085        throws IllegalStateException;
086
087}
088