Class DaemonWrapper
java.lang.Object
org.apache.commons.daemon.support.DaemonWrapper
- All Implemented Interfaces:
Daemon
Implementation of the Daemon that allows running
standard applications as daemons.
The applications must have the mechanism to manage
the application lifecycle.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Frees any resources allocated by this daemon such as file descriptors or sockets.void
init
(DaemonContext context) Called from DaemonLoader on init stage.void
start()
Starts the operation of thisDaemon
instance.void
stop()
Stops the operation of thisDaemon
instance.
-
Constructor Details
-
DaemonWrapper
public DaemonWrapper()Constructs a new initialized instance.
-
-
Method Details
-
init
Called from DaemonLoader on init stage.Accepts the following configuration arguments:
- -daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults
- -start: set start class name
- -start-method: set start method name
- -stop: set stop class name
- -stop-method: set stop method name
- -stop-argument: set optional argument to stop method
- Anything else is treated as a startup argument
The following "-daemon-properties" are recognized:
- args (startup argument)
- start
- start.method
- stop
- stop.method
- stop.args
-
start
Description copied from interface:Daemon
Starts the operation of thisDaemon
instance. This method is to be invoked by the environment after the init() method has been successfully invoked and possibly the security level of the JVM has been dropped. Implementors of this method are free to start any number of threads, but need to return control after having done that to enable invocation of the stop()-method. -
stop
Description copied from interface:Daemon
Stops the operation of thisDaemon
instance. Note that the proper place to free any allocated resources such as sockets or file descriptors is in the destroy method, as the container may restart the Daemon by calling start() after stop(). -
destroy
Description copied from interface:Daemon
Frees any resources allocated by this daemon such as file descriptors or sockets. This method gets called by the container after stop() has been called, before the JVM exits. The Daemon cannot be restarted after this method has been called without a new call to the init() method.
-