[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[equinox-dev] Why would DS register a component twice?
|
I have a component I have defined with a factory:
<scr:component
xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="com.bea.core.adg"
factory="com.bea.core.adg">
<implementation
class="com.bea.core.adg.internal.AcyclicalDirectedGraphImpl"/>
<service>
<provide interface="com.bea.core.adg.AcyclicalDirectedGraph" />
</service>
<property
name="com.bea.core.adg.name"
type="String"
value="dag"/>
</scr:component>
I have another component that is the "manager" for this factory:
<scr:component
xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="com.bea.core.adgFactory"
immediate="true">
<implementation
class="com.bea.core.adg.internal.AcyclicalDirectedGraphManagerImpl"/>
<service>
<provide interface="com.bea.core.adg.AcyclicalDirectedGraphManager"
/>
</service>
<reference name="ComponentFactory"
interface="org.osgi.service.component.ComponentFactory"
bind="setComponentFactory"
target="(&(component.name=com.bea.core.adg)(component.factory=com.be
a.core.adg))"
/>
</scr:component>
When I call the "create" service in the com.bea.core.adgFactory it ends
up calling the "newInstance" in order to create the first component
(with a name value).
What I am seeing is the component gets created OK, but it is getting
created twice. I have put println's before and after the newInstance
call, and I have put println's in the "activate" call of the first
component. This is what I am seeing. I will number the lines from the
output:
1. JRW(10) factory before newInstance <-- println before newInstance
call
2. INFO: Service REGISTERED: { com.bea.core.adg.name=Good Graph,
component.factory=
com.bea.core.adg, component.name=com.bea.core.adg, component.id=3,
objectClass=[
Ljava.lang.String;@d70d7a, service.id=10 } <-- from the framework
3. JRW(10) activation of name Good Graph with id 11240763 <-- activate
println
4. JRW(10) gt setting graph to 11240763 <-- dependency getting injected
in test (using ServiceTracker)
5. JRW(10) activation of name Good Graph with id 12067688 <-- ?println?
again?
6. JRW(20) factory after newInstance <-- println after newInstance call
Line 5 is the strange one (and causing me problems)! Why am I getting
the second activation? Is it a bug in the implementation, or is there
something I am not understanding about the specification? I do *not*
think this is a dummy service (since this is using the factory pattern).
Any help would be appreciated.
John Wells (Aziz)
jwells@bea.comNOSPAM
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.