Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.daemon.support
Class DaemonWrapper

    java.lang.Object
      org.apache.commons.daemon.support.DaemonWrapper

All Implemented Interfaces:
  Daemon

    public class DaemonWrapper

extends java.lang.Object
implements Daemon

Implementation of the Daemon that allows running standard applications as daemons. The applications must have the mechanism to manage the application lifecycle.

Version:
  1.0 (SVN $Revision: 925053 $)
Author:
  Mladen Turk

Constructor Summary
`DaemonWrapper()`

Method Summary
`void` | `destroy()` Free any resources allocated by this daemon such as file descriptors or sockets.
`void` | `init(DaemonContext context)` Called from DaemonLoader on init stage.
`void` | `start()` Start the operation of this `Daemon` instance.
`void` | `stop()` Stop the operation of this `Daemon` instance.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DaemonWrapper

    public DaemonWrapper()

Method Detail

### init

    public void init(DaemonContext context)
              throws java.lang.Exception

  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 recognised:

  - args (startup argument)
  - start
  - start.method
  - stop
  - stop.method
  - stop.args
  These are used to set the corresponding item if it has not already been set by the command arguments. However, note that args and stop.args are appended to any existing values.

  Specified by:
    `init` in interface `Daemon`
  Parameters:
    `context` - A `DaemonContext` object used to communicate with the container.
  Throws:
    `DaemonInitException` - An exception that prevented initialization where you want to display a nice message to the user, rather than a stack trace.
    `java.lang.Exception` - Any exception preventing a successful initialization.

### start

    public void start()
               throws java.lang.Exception

  Description copied from interface: `Daemon`
  Start the operation of this `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.

  Specified by:
    `start` in interface `Daemon`
  Throws:
    `java.lang.Exception`

### stop

    public void stop()
              throws java.lang.Exception

  Description copied from interface: `Daemon`
  Stop the operation of this `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().

  Specified by:
    `stop` in interface `Daemon`
  Throws:
    `java.lang.Exception`

### destroy

    public void destroy()

  Description copied from interface: `Daemon`
  Free 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 can not be restarted after this method has been called without a new call to the init() method.

  Specified by:
    `destroy` in interface `Daemon`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2002-2011 - Apache Software Foundation