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 * @throws IllegalStateException If the daemon is not in a valid state to be 058 * shutdown 059 */ 060 void fail(String message) 061 throws IllegalStateException; 062 063 /** 064 * Shuts down daemon and logs failed message. 065 * 066 * @param exception The exception to log 067 * @throws IllegalStateException If the daemon is not in a valid state to be 068 * shutdown 069 */ 070 void fail(Exception exception) 071 throws IllegalStateException; 072 073 /** 074 * Shuts down daemon and logs failed message. 075 * 076 * @param message The message to log 077 * @param exception The exception to log 078 * @throws IllegalStateException If the daemon is not in a valid state to be 079 * shutdown 080 */ 081 void fail(String message, Exception exception) 082 throws IllegalStateException; 083 084} 085