felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r987878 - /felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
Date Sun, 22 Aug 2010 12:01:40 GMT
Author: pderop
Date: Sun Aug 22 12:01:40 2010
New Revision: 987878

URL: http://svn.apache.org/viewvc?rev=987878&view=rev
Log:
fixed javadoc

Modified:
    felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java

Modified: felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java?rev=987878&r1=987877&r2=987878&view=diff
==============================================================================
--- felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
(original)
+++ felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
Sun Aug 22 12:01:40 2010
@@ -28,17 +28,17 @@ import java.lang.annotation.Target;
  * Injects a <code>Runnable</code> object in a Service for starting/stopping
it programatically.
  * By default, a Service is implicitly started when the service's bundle is started and when

  * all required dependencies are satisfied. However, it is sometimes required to programatically

- * take control of when the service started or stopped. In this case, the injected <code>Runnable</code>

+ * take control of when the service is started or stopped. In this case, the injected <code>Runnable</code>

  * can be invoked in order to start (and eventually register) a Service at any time. When
this annotation 
- * is used, then the Service on which this annotation is applied is not provided once the
Service is ready, 
- * as it is the case by default and you have to call the injected Runnable yourself. 
+ * is used, then the Service on which this annotation is applied is not activated by default,
and you have to 
+ * call the injected Runnable yourself. 
  * <p>
  * <h3>Usage Examples</h3>
  * <blockquote>
  * 
  * <pre>
  * &#47;**
- *   * This Service will be registered programatically into the OSGi registry, using the
publisher attribute.
+ *   * This Service will be registered programatically into the OSGi registry, using the
LifecycleController annotation.
  *   *&#47;
  * &#64;Service
  * class X implements Z {
@@ -47,17 +47,20 @@ import java.lang.annotation.Target;
  *   
  *     &#64;Init
  *     void init() {
- *         // Our component won't be started by default once the bundle is started and when
all
- *         // required dependencies are injected. Our Component will be registered only when
we
- *         // decide to invoke the Runnable injected by the LifecycleController annotation.
- *     }
- *   
- *     public void registerServiceWheneverIWant() {
- *         m_starter.run(); // start our component.
+ *         // At this point, all required dependencies are there, but we'll activate our
service in 2 seconds ...
+ *         Thread t = new Thread() {
+ *            public void run() {
+ *              sleep(2000);
+ *              m_starter.run();
+ *            }
+ *          };
+ *          t.start();
  *     }
  *     
+ *     &#64;Start
  *     public void start() {
- *         // This method will be called after we invoke our m_starter Runnable.
+ *         // This method will be called after we invoke our m_starter Runnable, and our
service will be
+ *         // published after our method returns, as in normal case.
  *     }
  * }
  * </pre>
@@ -68,7 +71,7 @@ import java.lang.annotation.Target;
 public @interface LifecycleController
 {
     /**
-     * Specify the action to be performed when the Injected runnable is invoked. By default,
the
+     * Specifies the action to be performed when the Injected runnable is invoked. By default,
the
      * Runnable will fire a Service Component activation, when invoked. If you specify this
attribute
      * to false, then the Service Component will be stopped, when the runnable is invoked.
      */



Mime
View raw message