aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Gormley (JIRA)" <>
Subject [jira] [Created] (ARIES-1201) Blueprint start can hang when using reference-listeners
Date Fri, 30 May 2014 15:17:02 GMT
Simon Gormley created ARIES-1201:

             Summary: Blueprint start can hang when using reference-listeners
                 Key: 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"/>
<bean id="AImplBeanBean" class="bundle2.AImplBean" init-method="init">
  <property name="i" ref="i"/>
<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"/>
<service id="BImplBeanBeanService" ref="BImplBeanBean"
  interface="api.InterfaceB" />
<reference interface="api.InterfaceA" id="A"/>

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

This message was sent by Atlassian JIRA

View raw message