[
https://issues.apache.org/jira/browse/ARIES-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13419842#comment-13419842
]
Holly Cummins commented on ARIES-584:
-------------------------------------
Fixed in the nick of time, before the blueprint.cm release. Thanks for the
patch.
I had some difficulty reproducing this problem in our ConfigAdminTest. However,
I could sometimes reproduce it, which makes me conclude there's a concurrency
element to the problem. I think this means the patch isn't quite the right fix,
although it definitely points to the right area.
The updated() method on the CmManagedServiceFactory does checks if the pid
exists, and only registers a service if the pid doesn't, so calling it twice
shouldn't be a problem. Problems do happen when the updated() method is driven
by both the init() method and configuration admin concurrently. My suspicion is
that removing the updated() call in the init method exposes us to problems - if
the ConfigurationWatcher is registered too late, it won't be notified of config
changes, and the service won't be registered at all. I've synchronized the
updated() method so that we don't check whether the pid has been registered
until we're sure any previous registration has completed.
I've also updated our TestConfigAdmin test to make sure only one service is
registered, although this test was passing even for the original code, unless I
changed the concurrency by removing other tests.
I haven't applied a fix to the 0.3.1 branch, since I'm not sure if there will
be more releases on that.
> Blueprint Managed Service Factory Instantiates Duplicate Service
> ----------------------------------------------------------------
>
> Key: ARIES-584
> URL: https://issues.apache.org/jira/browse/ARIES-584
> Project: Aries
> Issue Type: Bug
> Components: Blueprint
> Affects Versions: 0.2, 0.3
> Environment: Mac OSX 10.6.6 / Equinox 3.6.1 / Felix Config Admin
> 1.2.8 / Aries Blueprint 0.3 (and 0.2)
> Reporter: Greg Rapp
> Assignee: Holly Cummins
> Fix For: 1.0
>
> Attachments: logs.txt, org.apache.aries.blueprint.cm-0.3.1.patch,
> org.apache.aries.blueprint.cm.patch-withtrunk.patch
>
>
> Creating a simple managed service factory, two services are instantiated for
> a single factory configuration.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira