You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by bu...@apache.org on 2018/10/17 21:08:09 UTC
svn commit: r1036355 - in /websites/staging/felix/trunk/content: ./
documentation/subprojects/apache-felix-dependency-manager/reference/service-scopes.html
Author: buildbot
Date: Wed Oct 17 21:08:09 2018
New Revision: 1036355
Log:
Staging update by buildbot for felix
Modified:
websites/staging/felix/trunk/content/ (props changed)
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/service-scopes.html
Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Oct 17 21:08:09 2018
@@ -1 +1 @@
-1844125
+1844174
Modified: websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/service-scopes.html
==============================================================================
--- websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/service-scopes.html (original)
+++ websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/service-scopes.html Wed Oct 17 21:08:09 2018
@@ -195,11 +195,11 @@ you can also do it like this:</p>
<h1 id="scoped-services-and-initdestroy-callbacks">Scoped services and init/destroy callbacks<a class="headerlink" href="#scoped-services-and-initdestroy-callbacks" title="Permanent link">¶</a></h1>
-<p>When you need to specify dynamic dependencies from your component.init() method,
+<p>When you need to specify dynamic required dependencies from your component.init() method,
the following mechanism will be used:</p>
-<p>first, if your component defines an init callback, then one single component prototype instance singleton is created, as if the component is declared with SCOPE=SINGLETON.
-so, the prototype instance will be invoked in the init callback, but won't be started or stopped
-and when all dependencies are satisfied (including the dynamic dependencies),
+<p>First, if your component defines an init callback, then one single component prototype instance singleton is created, as if the component is declared with SCOPE=SINGLETON.
+So, the prototype instance will be invoked in the init callback, but won't be called in start()/stop().
+And when all dependencies are satisfied and injected (including the dynamic dependencies defined in the init method),
then the ServiceFactory (or PrototypeServiceFactory) is registered.
And when one client will request a component instance, then a clone will be created and returned.</p>
<p>Example of a scoped component which defines an init method:</p>
@@ -215,11 +215,11 @@ And when one client will request a compo
<span class="kd">public</span> <span class="kd">static</span> <span class="kd">class</span> <span class="nc">MyServiceImpl</span> <span class="kd">implements</span> <span class="n">MyService</span> <span class="o">{</span>
<span class="kt">void</span> <span class="nf">init</span><span class="o">(</span><span class="n">Component</span> <span class="n">comp</span><span class="o">)</span> <span class="o">{</span>
- <span class="c1">// add dependencies dynamically</span>
+ <span class="c1">// add required dependencies dynamically</span>
<span class="o">}</span>
<span class="kt">void</span> <span class="nf">start</span><span class="o">()</span> <span class="o">{</span>
- <span class="c1">// only called on clones, not on the prototype instance</span>
+ <span class="c1">// only called on clone, not on the prototype instance singleton</span>
<span class="o">}</span>
<span class="kt">void</span> <span class="nf">stop</span><span class="o">()</span> <span class="o">{</span>
@@ -229,12 +229,11 @@ And when one client will request a compo
</pre></div>
-<p>So, if you don't need an init callback then use the <code>Component.setCallbacks(null, "start", "stop", null)</code>
-method in order to avoid the creation of the prototype instance.</p>
+<p>So, if you don't specify an init callback then the prototype instance singleton won't be instantiated. Also, </p>
<h1 id="limitation-when-using-dm-servicedependency-from-api-and-serviceobjects">Limitation when using DM ServiceDependency from API and ServiceObjects<a class="headerlink" href="#limitation-when-using-dm-servicedependency-from-api-and-serviceobjects" title="Permanent link">¶</a></h1>
-<p>When using DependencyManager ServiceDependency from the native API (not using annotations),
-you have to know that the ServiceDependency always internally dereferences and creates the
-scoped service, even if you specify a ServiceObjecs
+<p>When using DependencyManager ServiceDependency from the DM API (not using annotations),
+you have to know that the ServiceDependency always internally dereferences the
+service dependency, even if you specify a ServiceObjecs
parameter in your bind method. If now you really want to disable the auto-deref ServiceDependency
(because you want to directly use the ServiceObjects API), you must then use the
"setDereference(false") method on your ServiceDependency: in this way, you tell DM to never
@@ -269,7 +268,7 @@ create the MyService instances manually.
never auto-dereference the injected service in case the bind method takes as argument a
ServiceObjects (or a ServiceReference) method.</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
- Rev. 1843368 by pderop on Tue, 9 Oct 2018 23:21:17 +0000
+ Rev. 1844174 by pderop on Wed, 17 Oct 2018 21:07:30 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project