public interface Daemon
Daemoninterface can be initialized, started and stopped according to the conventions of the underlying operating system.
Implementors of this interface must also provide a public constructor with no arguments so that instances can be created in an automated fashion.
|Modifier and Type||Method and Description|
Frees any resources allocated by this daemon such as file descriptors or sockets.
Starts the operation of this
Stops the operation of this
void init(DaemonContext context) throws DaemonInitException, Exception
This method gets called once the JVM process is created and the
Daemon instance is created thru its empty public
Under certain operating systems (typically Unix based operating systems) and if the native invocation framework is configured to do so, this method might be called with super-user privileges.
For example, it might be wise to create
instances within the scope of this method, and perform all operations
requiring super-user privileges in the underlying operating
Apart from set up and allocation of native resources, this method
must not start the actual operation of the
as starting threads calling the
method) as this would impose some serious security hazards. The
start of operation must be performed in the
DaemonContextobject used to communicate with the container.
DaemonInitException- An exception that prevented initialization where you want to display a nice message to the user, rather than a stack trace.
Exception- Any exception preventing a successful initialization.
void start() throws Exception
Daemoninstance. 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.
void stop() throws Exception
Daemoninstance. 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().
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.