git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Commented] (ARIES-1841) Race condition on blueprint-cm with ConfigAdmin


    [ https://issues.apache.org/jira/browse/ARIES-1841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678559#comment-16678559 ] 

Jean-Baptiste Onofré commented on ARIES-1841:
---------------------------------------------

{{cm-properties}} code comes directly from the "old" spring-dm one. It's async by default (like the placeholder). The workaround is to directly use and inject ConfigAdmin in the blueprint bundle. I tested and it works fine.

For this {{cm-properties}}, after thinking twice about that, I don't think it's a good idea to have a flag for waiting a configuration (it breaks kind of {{ManagedService}} design implemented by blueprint-cm). Basically, the bundle developer should deal with dynamism.

Anyway, I will do some cleanup on the {{cm-properties}} (and also placeholder) codebase.

For users who wants config sync, I really encourage to directly use ConfigAdmin (configadmin properties update is sync, the ConfigListener and ManagedService callback are async).

> Race condition on blueprint-cm with ConfigAdmin
> -----------------------------------------------
>
>                 Key: ARIES-1841
>                 URL: https://issues.apache.org/jira/browse/ARIES-1841
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-core-1.9.0, blueprint-core-1.8.3
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: blueprint-core-1.8.4, blueprint-core-1.9.1
>
>
> If a blueprint bundle use CM like:
> {code}
> <cm-properties persistent-id="persistentId" id="my.config" xmlns="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"/>
> {code}
> if the configuration is created by another bundle (directly using {{ConfigurationAdmin}}) like:
> {code}
>         Configuration configuration = configurationAdmin.getConfiguration(CONFIG_PID, null);
>         Dictionary<String, Object> dictionary = Optional.ofNullable(configuration.getProperties()).orElse(new Hashtable());
>         for (Map.Entry entry : properties.entrySet()) {
>             dictionary.put(entry.getKey().toString(), entry.getValue());
>         }
>        configuration.update(dictionary);
> {code}
> then, it's possible to have a race condition where the blueprint container thread starts whereas the config update is not complete (two different threads).
> Blueprint CM should have an option to wait an updated config. For instance, it could check {{\_felix\_.cm.newConfiguration}} property.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)