pier 01/07/30 18:26:39
Modified: java/org/apache/service Service.java
Log:
Final layout of the Service interface. Craig and Kevin convinced me that
this is the best way to go:
- init() and destroy() will be tied to the lifecycle of the VM process in
the underlying operating system
- start() and stop() will allow starting and stopping of the Service several
times during the VM process life.
Revision Changes Path
1.2 +36 -2 jakarta-tomcat-service/java/org/apache/service/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-service/java/org/apache/service/Service.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Service.java 2001/07/30 23:23:55 1.1
+++ Service.java 2001/07/31 01:26:39 1.2
@@ -61,14 +61,43 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
* @author Copyright © 2000-2001 <a href="http://www.apache.org/">The
* Apache Software Foundation</a>. All rights reserved.
- * @version 1.0 <i>(CVS $Revision: 1.1 $)</i>
+ * @version 1.0 <i>(CVS $Revision: 1.2 $)</i>
*/
public interface Service {
/**
+ * Initialize this <code>Service</code> instance.
+ * <p>
+ * This method gets called once the JVM process is created and the
+ * <code>Service</code> instance is created thru its empty public
+ * constructor.
+ * </p>
+ * <p>
+ * 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 <i>super-user</i> privileges.
+ * </p>
+ * <p>
+ * For example, it might be wise to create <code>ServerSocket</code>
+ * instances within the scope of this method, and perform all operations
+ * requiring <i>super-user</i> privileges in the underlying operating
+ * system.
+ * </p>
+ * <p>
+ * Apart from set up and allocation of native resources, this method
+ * must not start the actual operation of the <code>Service</code> (such
+ * as starting threads calling the <code>ServerSocket.accept()</code>
+ * method) as this would impose some serious security hazards. The
+ * start of operation must be performed in the <code>start()</code>
+ * method.
+ * </p>
*
+ * @param context The <code>ServiceContext</code> instance associated with
+ * service <code>Service</code> instance.
+ * @exception Exception Any exception preventing a successful
+ * initialization.
*/
- public void load(ServiceContext context)
+ public void init(ServiceContext context)
throws Exception;
/**
@@ -82,5 +111,10 @@
*/
public void stop()
throws Exception;
+
+ /**
+ *
+ */
+ public void destroy();
}