You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jf...@apache.org on 2003/09/26 11:26:05 UTC

cvs commit: jakarta-commons/daemon/src/java/org/apache/commons/daemon Daemon.java DaemonContext.java

jfclere     2003/09/26 02:26:04

  Modified:    daemon/src/java/org/apache/commons/daemon Daemon.java
                        DaemonContext.java
  Log:
  Add some documentation. Submitted by Daniel Resare, noa at metamatrix.se.
  
  Revision  Changes    Path
  1.2       +30 -7     jakarta-commons/daemon/src/java/org/apache/commons/daemon/Daemon.java
  
  Index: Daemon.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/java/org/apache/commons/daemon/Daemon.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Daemon.java	4 Sep 2003 23:28:20 -0000	1.1
  +++ Daemon.java	26 Sep 2003 09:26:04 -0000	1.2
  @@ -58,7 +58,16 @@
   package org.apache.commons.daemon;
   
   /**
  - *
  + * This interface provides support for native daemon invocation. Using
  + * a platform dependant helper program classes that implement the
  + * <code>Daemon</code> interface can be initialized, started and
  + * stopped according to the convensions of the underlying operating
  + * system.
  + * <p>
  + * Implementors of this interface must also provide a public constructor
  + * with no arguments so that instances can be created in an automated
  + * fashion.
  + * </p>
    * @author <a href="mailto:pier.fumagalli@sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 2000-2001 <a href="http://www.apache.org/">The
    *         Apache Software Foundation</a>. All rights reserved.
  @@ -93,8 +102,9 @@
        *   method.
        * </p>
        *
  -     * @param context The <code>DaemonContext</code> instance associated with
  -     *                daemon <code>Daemon</code> instance.
  +     * @param context A <code>DaemonContext</code> object used to
  +     * communicate with the container.
  +     * 
        * @exception Exception Any exception preventing a successful
        *                      initialization.
        */
  @@ -102,20 +112,33 @@
       throws Exception;
   
       /**
  -     *
  +     * Start the operation of this <code>Daemon</code> 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.  <code>Implementors of this
  +     * method are free to start any number of threads, but need to
  +     * return control avfter having done that to enable invocation of
  +     * the stop()-method.
        */
       public void start()
       throws Exception;
   
       /**
  -     *
  +     * Stop the operation of this <code>Daemon</code> 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().
        */
       public void stop()
       throws Exception;
   
       /**
  -     * 
  +     * 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.
        */
       public void destroy();
  -
   }
  
  
  
  1.2       +9 -2      jakarta-commons/daemon/src/java/org/apache/commons/daemon/DaemonContext.java
  
  Index: DaemonContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/java/org/apache/commons/daemon/DaemonContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DaemonContext.java	4 Sep 2003 23:28:20 -0000	1.1
  +++ DaemonContext.java	26 Sep 2003 09:26:04 -0000	1.2
  @@ -59,6 +59,8 @@
   
   
   /**
  + * Defines a set of methods that a Daemon instance can use to
  + * communicate with the Daemon container.
    *
    * @author <a href="mailto:pier.fumagalli@sun.com">Pier Fumagalli</a>
    * @author Copyright &copy; 2000-2001 <a href="http://www.apache.org/">The
  @@ -68,12 +70,17 @@
   public interface DaemonContext {
   
       /**
  -     *
  +     * Returns  <code>DaemonController</code> object that can be used
  +     * to control the <code>Daemon</code> instance that this
  +     * <code>DaemonContext</code> is passed to.
        */
       public DaemonController getController();
   
       /**
  -     *
  +     * Returns an array of <code>String</code> arguments supplied by
  +     * the environment.  corresponding to the array of arguments given
  +     * in the <code>public static void main()</code> method used as an
  +     * entry point to most other java programs.
        */
       public String[] getArguments();