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 * https://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 * Defines methods needed by the DaemonLoader.
22 */
23 public interface DaemonController
24 {
25
26 /**
27 * Shuts down the daemon.
28 *
29 * @throws IllegalStateException If the daemon is not in a valid state to be
30 * shutdown
31 */
32 void shutdown()
33 throws IllegalStateException;
34
35 /**
36 * Reloads daemon
37 *
38 * @throws IllegalStateException If the daemon is not in a valid state to be
39 * reloaded
40 */
41 void reload()
42 throws IllegalStateException;
43
44 /**
45 * Shuts down daemon and logs failed message.
46 *
47 * @throws IllegalStateException If the daemon is not in a valid state to be
48 * shutdown
49 */
50 void fail()
51 throws IllegalStateException;
52
53 /**
54 * Shuts down daemon and logs failed message.
55 *
56 * @param message The message to log
57 * @throws IllegalStateException If the daemon is not in a valid state to be
58 * shutdown
59 */
60 void fail(String message)
61 throws IllegalStateException;
62
63 /**
64 * Shuts down daemon and logs failed message.
65 *
66 * @param exception The exception to log
67 * @throws IllegalStateException If the daemon is not in a valid state to be
68 * shutdown
69 */
70 void fail(Exception exception)
71 throws IllegalStateException;
72
73 /**
74 * Shuts down daemon and logs failed message.
75 *
76 * @param message The message to log
77 * @param exception The exception to log
78 * @throws IllegalStateException If the daemon is not in a valid state to be
79 * shutdown
80 */
81 void fail(String message, Exception exception)
82 throws IllegalStateException;
83
84 }
85