You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Isart Canyameres <is...@i2cat.net> on 2014/04/25 11:42:14 UTC

CmPropertyPlaceholder reloading blueprintContainer without property changes

Hi,

I've been investigating a bit more about the issue in following thread:
https://mail-archives.apache.org/mod_mbox/karaf-user/201404.mbox/%3CCACnPcpNxfAt-5G-WGr74%3DeU2Z4%2BdjNCVBh2QfgioZ8vDUh790Q%40mail.gmail.com%3E

It is related with CmPropertyPlaceholder in blueprint when using 
pax-exam 3.4.0 (we are using org.apache.aries.blueprint.cm/1.0.3)
CmPropertyPlaceholder is continuously reloading the blueprintContainer, 
causing services come and go.
The issue seems not to appear when using karaf without pax-exam.
I attach a blueprint.xml file with the configuration related with this 
issue.

org.apache.aries.blueprint.cm.CmPropertyPlaceholder.updated(Dictionary) 
method is called multiple times with null value, resulting in reloading 
the  blueprintContainer when properties are not null (in our case):

org.apache.aries.blueprint.cm.CmPropertyPlaceholder:
     public void updated(Dictionary props) {
         if ("reload".equalsIgnoreCase(updateStrategy) && 
!equals(properties, props)) {
             LOGGER.debug("Configuration updated for pid={}", persistentId);
             // Run in a separate thread to avoid re-entrance
             new Thread() {
                 public void run() {


                     blueprintContainer.reload();
                 }
             }.start();
         }
     }

properties =
{service.pid=org.opennaas, ws.rest.url=/opennaas, 
felix.fileinstall.filename=file:/workingDirectory/itests/target/paxexam/edabb24b-d240-4abe-be54-723c84386d84/etc/org.opennaas.cfg}

props = null


The following line in the logs appears when the container is about to be 
reloaded:
"Configuration updated for pid=org.opennaas"

This entry appears a random number of times (between 2 and 40) in the 
log for a single itest using pax-exam.
The test has an @Inject for the BlueprintContainer in an attempt to 
enforce the container is initialized when the test runs. However, due to 
the container being reloaded multiple times, this condition cannot be 
guaranteed.

This entry does NOT appear when launching karaf normally (not using 
testing framework).

I don't understand why, but looking at attached thread-stack, it seems 
that a thread called /[CM Configuration Updater (ManagedService Update: 
pid=[org.opennaas])]/ is continuously detecting updates and calling 
ManagedObjectManager$ConfigurationWatcher.updated(Dictionary) with null 
Dictionary. Which eventually ends up reloading the blueprintContainer.

Is there any way to avoid this issue?
I'd expect the container to be reloaded when properties change, but to 
remain untouched if that's not the case. Is my expectation aligned with 
the expected behaviour?

Many thanks for your help,

-- 
Isart Canyameres Gim�nez

Distributed Applications and Networks Area (DANA)
Fundaci� i2CAT, Internet i Innovaci� Digital a Catalunya, Barcelona, Spain
T: +34 93 553 25 49 - http://dana.i2cat.net