Simon Gormley created ARIES-1201:
------------------------------------

             Summary: Blueprint start can hang when using reference-listeners
                 Key: ARIES-1201
                 URL: https://issues.apache.org/jira/browse/ARIES-1201
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
            Reporter: Simon Gormley


Blueprint startup can hang if a reference listener uses the same bean as it is 
tracking.

For the blueprints included below, blueprints 1 and 2 start processing on 
different threads. Blueprint 2 tries to get the service from blueprint 1, but 
blocks as blueprint 1's bean is waiting for the reference to become available. 
Blueprint 1 runs, tries to create the reference, and so needs to create the 
bean, but can't as blueprint 2 has started this, and so blueprint 1 can't 
complete to release blueprint 2.

Essentially, this happens as the blueprint service is registered before it is 
completely ready to be used. If the eager components were created before 
registering, the service would be ready to be used straight away. Section 121.6 
of the OSGi spec indicates that a blueprint service shouldn't be registered 
before it is ready.

Blueprint 1:
<reference id="i" interface="api.Interface">
  <reference-listener ref="AImplBeanBean" unbind-method="unbound"/>
</reference>
<bean id="AImplBeanBean" class="bundle2.AImplBean" init-method="init">
  <property name="i" ref="i"/>
</bean>
<service id="ASrv" ref="AImplBeanBean" interface="api.InterfaceA" 
activation="eager"></service>

Blueprint 2:
<bean id="BImplBeanBean" class="bundle3.BImplBean"
 init-method="init" activation="lazy">
  <property name="a" ref="A"/>
</bean>
<service id="BImplBeanBeanService" ref="BImplBeanBean"
  interface="api.InterfaceB" />
<reference interface="api.InterfaceA" id="A"/>

Blueprint 3:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
default-activation="lazy">
<bean id="InterfaceImplBean" class="pmr40452.impl.InterfaceImpl" />
<service id="Impl" ref="InterfaceImplBean"
  interface="api.Interface" />
</blueprint>



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to