You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Guillaume Nodet <gn...@gmail.com> on 2012/11/16 11:59:05 UTC

Re: svn commit: r1402606 - in /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container: AbstractServiceReferenceRecipe.java BlueprintContainerImpl.java

The following change actually breaks the way processor works.
In karaf we do use layered property placeholders and this does not work
anymore.
For example, the following does not work anymore

    <ext:property-placeholder placeholder-prefix="$("
placeholder-suffix=")"/>

    <ext:property-placeholder placeholder-prefix="$["
placeholder-suffix="]" ignore-missing-locations="true">
        <ext:default-properties>
            <ext:property name="featuresRepositories" value=""/>
            <ext:property name="featuresBoot" value=""/>
            <ext:property name="resolverTimeout" value="5000"/>
        </ext:default-properties>

<ext:location>file:$(karaf.base)/etc/org.apache.karaf.features.cfg</ext:location>
    </ext:property-placeholder>


On Fri, Oct 26, 2012 at 8:19 PM, <dk...@apache.org> wrote:

> Author: dkulp
> Date: Fri Oct 26 18:19:16 2012
> New Revision: 1402606
>
> URL: http://svn.apache.org/viewvc?rev=1402606&view=rev
> Log:
> Attempt to fix some hard to debug blueprint "grace period" hangs.
> If a bundle has multiple processors, only stop and restart the services
> references once.
>
> Modified:
>
> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
>
> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
>
> Modified:
> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
> URL:
> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1402606&r1=1402605&r2=1402606&view=diff
>
> ==============================================================================
> ---
> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
> (original)
> +++
> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
> Fri Oct 26 18:19:16 2012
> @@ -475,6 +475,7 @@ public class BlueprintContainerImpl
>      }
>
>      private void processProcessors() throws Exception {
> +        boolean changed = false;
>          // Instanciate ComponentDefinitionRegistryProcessor and
> BeanProcessor
>          for (BeanMetadata bean : getMetadata(BeanMetadata.class)) {
>              if (bean instanceof ExtendedBeanMetadata &&
> !((ExtendedBeanMetadata) bean).isProcessor()) {
> @@ -495,12 +496,16 @@ public class BlueprintContainerImpl
>              if
> (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) {
>                  Object obj = repository.create(bean.getId(),
> ProxyUtils.asList(ComponentDefinitionRegistryProcessor.class));
>                  ((ComponentDefinitionRegistryProcessor)
> obj).process(componentDefinitionRegistry);
> +                changed = true;
>              } else if (Processor.class.isAssignableFrom(clazz)) {
>                  Object obj = repository.create(bean.getId(),
> ProxyUtils.asList(Processor.class));
>                  this.processors.add((Processor) obj);
> +                changed = true;
>              } else {
>                  continue;
>              }
> +        }
> +        if (changed) {
>              // Update repository with recipes processed by the processors
>              untrackServiceReferences();
>              Repository tmpRepo = new RecipeBuilder(this,
> tempRecipeIdSpace).createRepository();
> @@ -527,7 +532,6 @@ public class BlueprintContainerImpl
>                      LOGGER.debug("Recipe {} is already instantiated and
> cannot be updated", new Object[] { name });
>                  }
>              }
> -
>              getSatisfiableDependenciesMap(true);
>              trackServiceReferences();
>          }
>
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: svn commit: r1402606 - in /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container: AbstractServiceReferenceRecipe.java BlueprintContainerImpl.java

Posted by Daniel Kulp <dk...@apache.org>.
I added a test for this and managed to see the problem.   I've gone ahead and reverted the functionality change, but it's something I'd like to revisit at some point, just no time right now.

For every single processor, it's causing a stop/start of each of the service references.   If you have 10 processors, that's 10 stop/start cycles for every reference.   Keep in mind, each start involves a bunch of lookups, possible recreations of the proxies, etc..  Not cheap.

Dan



On Nov 16, 2012, at 5:59 AM, Guillaume Nodet <gn...@gmail.com> wrote:

> The following change actually breaks the way processor works.
> In karaf we do use layered property placeholders and this does not work
> anymore.
> For example, the following does not work anymore
> 
>    <ext:property-placeholder placeholder-prefix="$("
> placeholder-suffix=")"/>
> 
>    <ext:property-placeholder placeholder-prefix="$["
> placeholder-suffix="]" ignore-missing-locations="true">
>        <ext:default-properties>
>            <ext:property name="featuresRepositories" value=""/>
>            <ext:property name="featuresBoot" value=""/>
>            <ext:property name="resolverTimeout" value="5000"/>
>        </ext:default-properties>
> 
> <ext:location>file:$(karaf.base)/etc/org.apache.karaf.features.cfg</ext:location>
>    </ext:property-placeholder>
> 
> 
> On Fri, Oct 26, 2012 at 8:19 PM, <dk...@apache.org> wrote:
> 
>> Author: dkulp
>> Date: Fri Oct 26 18:19:16 2012
>> New Revision: 1402606
>> 
>> URL: http://svn.apache.org/viewvc?rev=1402606&view=rev
>> Log:
>> Attempt to fix some hard to debug blueprint "grace period" hangs.
>> If a bundle has multiple processors, only stop and restart the services
>> references once.
>> 
>> Modified:
>> 
>> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AbstractServiceReferenceRecipe.java
>> 
>> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
>> 
>> Modified:
>> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
>> URL:
>> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1402606&r1=1402605&r2=1402606&view=diff
>> 
>> ==============================================================================
>> ---
>> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
>> (original)
>> +++
>> aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
>> Fri Oct 26 18:19:16 2012
>> @@ -475,6 +475,7 @@ public class BlueprintContainerImpl
>>     }
>> 
>>     private void processProcessors() throws Exception {
>> +        boolean changed = false;
>>         // Instanciate ComponentDefinitionRegistryProcessor and
>> BeanProcessor
>>         for (BeanMetadata bean : getMetadata(BeanMetadata.class)) {
>>             if (bean instanceof ExtendedBeanMetadata &&
>> !((ExtendedBeanMetadata) bean).isProcessor()) {
>> @@ -495,12 +496,16 @@ public class BlueprintContainerImpl
>>             if
>> (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) {
>>                 Object obj = repository.create(bean.getId(),
>> ProxyUtils.asList(ComponentDefinitionRegistryProcessor.class));
>>                 ((ComponentDefinitionRegistryProcessor)
>> obj).process(componentDefinitionRegistry);
>> +                changed = true;
>>             } else if (Processor.class.isAssignableFrom(clazz)) {
>>                 Object obj = repository.create(bean.getId(),
>> ProxyUtils.asList(Processor.class));
>>                 this.processors.add((Processor) obj);
>> +                changed = true;
>>             } else {
>>                 continue;
>>             }
>> +        }
>> +        if (changed) {
>>             // Update repository with recipes processed by the processors
>>             untrackServiceReferences();
>>             Repository tmpRepo = new RecipeBuilder(this,
>> tempRecipeIdSpace).createRepository();
>> @@ -527,7 +532,6 @@ public class BlueprintContainerImpl
>>                     LOGGER.debug("Recipe {} is already instantiated and
>> cannot be updated", new Object[] { name });
>>                 }
>>             }
>> -
>>             getSatisfiableDependenciesMap(true);
>>             trackServiceReferences();
>>         }
>> 
>> 
>> 
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com