1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.commons.daemon; 19 20 21 /** 22 * Defines methods needed by the DaemonLoader. 23 */ 24 public interface DaemonController 25 { 26 27 /** 28 * Shuts down the daemon. 29 * 30 * @throws IllegalStateException If the daemon is not in a valid state to be 31 * shutdown 32 */ 33 void shutdown() 34 throws IllegalStateException; 35 36 /** 37 * Reloads daemon 38 * 39 * @throws IllegalStateException If the daemon is not in a valid state to be 40 * reloaded 41 */ 42 void reload() 43 throws IllegalStateException; 44 45 /** 46 * Shuts down daemon and logs failed message. 47 * 48 * @throws IllegalStateException If the daemon is not in a valid state to be 49 * shutdown 50 */ 51 void fail() 52 throws IllegalStateException; 53 54 /** 55 * Shuts down daemon and logs failed message. 56 * 57 * @param message The message to log 58 * 59 * @throws IllegalStateException If the daemon is not in a valid state to be 60 * shutdown 61 */ 62 void fail(String message) 63 throws IllegalStateException; 64 65 /** 66 * Shuts down daemon and logs failed message. 67 * 68 * @param exception The exception to log 69 * 70 * @throws IllegalStateException If the daemon is not in a valid state to be 71 * shutdown 72 */ 73 void fail(Exception exception) 74 throws IllegalStateException; 75 76 /** 77 * Shuts down daemon and logs failed message. 78 * 79 * @param message The message to log 80 * @param exception The exception to log 81 * 82 * @throws IllegalStateException If the daemon is not in a valid state to be 83 * shutdown 84 */ 85 void fail(String message, Exception exception) 86 throws IllegalStateException; 87 88 } 89