public class ExporterDaemon extends Object implements org.apache.commons.daemon.Daemon
Daemon
Constructor and Description |
---|
ExporterDaemon() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Frees any resources allocated by this daemon such as file
descriptors or sockets.
|
void |
init(org.apache.commons.daemon.DaemonContext ctx)
Initializes this
Daemon instance. |
void |
start()
Starts the operation of this
Daemon instance. |
void |
stop()
Stops the operation of this
Daemon instance. |
public void destroy()
org.apache.commons.daemon.Daemon
destroy
in interface org.apache.commons.daemon.Daemon
public void init(org.apache.commons.daemon.DaemonContext ctx) throws Exception
org.apache.commons.daemon.Daemon
Daemon
instance.
This method gets called once the JVM process is created and the
Daemon
instance is created thru its empty public
constructor.
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 ServerSocket
instances within the scope of this method, and perform all operations
requiring super-user privileges in the underlying operating
system.
Apart from set up and allocation of native resources, this method
must not start the actual operation of the Daemon
(such
as starting threads calling the ServerSocket.accept()
method) as this would impose some serious security hazards. The
start of operation must be performed in the start()
method.
init
in interface org.apache.commons.daemon.Daemon
ctx
- A DaemonContext
object used to
communicate with the container.org.apache.commons.daemon.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.public void start() throws Exception
org.apache.commons.daemon.Daemon
Daemon
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.start
in interface org.apache.commons.daemon.Daemon
Exception
public void stop() throws Exception
org.apache.commons.daemon.Daemon
Daemon
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().stop
in interface org.apache.commons.daemon.Daemon
Exception
Copyright © 2016 Eclipse NeoSCADA Project. All rights reserved.