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/** 022 * Defines methods needed by the DaemonLoader. 023 */ 024public interface DaemonController 025{ 026 027 /** 028 * Shuts down the daemon. 029 * 030 * @throws IllegalStateException If the daemon is not in a valid state to be 031 * shutdown 032 */ 033 void shutdown() 034 throws IllegalStateException; 035 036 /** 037 * Reloads daemon 038 * 039 * @throws IllegalStateException If the daemon is not in a valid state to be 040 * reloaded 041 */ 042 void reload() 043 throws IllegalStateException; 044 045 /** 046 * Shuts down daemon and logs failed message. 047 * 048 * @throws IllegalStateException If the daemon is not in a valid state to be 049 * shutdown 050 */ 051 void fail() 052 throws IllegalStateException; 053 054 /** 055 * Shuts down daemon and logs failed message. 056 * 057 * @param message The message to log 058 * 059 * @throws IllegalStateException If the daemon is not in a valid state to be 060 * shutdown 061 */ 062 void fail(String message) 063 throws IllegalStateException; 064 065 /** 066 * Shuts down daemon and logs failed message. 067 * 068 * @param exception The exception to log 069 * 070 * @throws IllegalStateException If the daemon is not in a valid state to be 071 * shutdown 072 */ 073 void fail(Exception exception) 074 throws IllegalStateException; 075 076 /** 077 * Shuts down daemon and logs failed message. 078 * 079 * @param message The message to log 080 * @param exception The exception to log 081 * 082 * @throws IllegalStateException If the daemon is not in a valid state to be 083 * shutdown 084 */ 085 void fail(String message, Exception exception) 086 throws IllegalStateException; 087 088} 089