[
https://issues.apache.org/jira/browse/FELIX-4238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13777448#comment-13777448
]
Matthias commented on FELIX-4238:
---------------------------------
Thanks, Felix, for the quick reply. You understood my problem correct. The
problem is that after a persistence manager changes (come or go) the internal
list of persistence managers is recreated always although there was no further
change.
Whenever a persistence manager disappears and re-appears, the if-condition in
line 819 is always true and, thus, the internal list of persistence managers is
recreated whenever the method getPersistenceManagers() is called. That means
each time the getConfiguration() method is called, the internal list of
persistence managers is recreated which can be annoying because then the cache
of CachingPersistenceManagerProxy has to be re-read. In my case properties are
loaded from a remote server which takes some time, which then requires ca. 20
seconds to load 10 configurations.
To make it clear, let me give you an example:
(1) First call of getConfiguration(): No custom persistence manager, only
default FilePersistenceManager --> currentPmtCount=1, pmtCount=0 --> recreation
of internal list of persistence managers
(2) Every consecutive call of getConfiguration(): currentPmtCount=1, pmtCount=1
--> no recreation of internal list of persistence managers
(3) Registration of custom persistence manager
(4) First call of getConfiguration(): currentPmtCount=2, pmtCount=1 -->
recreation internal list of persistence managers
(5) Every consecutive call of getConfiguration() --> currentPmtCount=2,
pmtCount=2 --> no recreation of internal list of persistence managers
(6) Deregistration of custom persistence manager
(7) Every consecutive call of getConfiguration() --> currentPmtCount=3,
pmtCount=1 --> recreation of internal list of persistence managers
(*) From now on, every call of getConfiguration() will trigger a recreation of
the internal list of persistence managers
> Unnecessary re-initialization of PersistenceManagers in configadmin
> -------------------------------------------------------------------
>
> Key: FELIX-4238
> URL: https://issues.apache.org/jira/browse/FELIX-4238
> Project: Felix
> Issue Type: Bug
> Components: Configuration Admin
> Affects Versions: configadmin-1.6.0
> Environment: MacOSX 10.8.5, Java 1.6.0_51, org.eclipse.osgi 3.9.0
> Reporter: Matthias
> Priority: Minor
> Labels: patch
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> Brief description: If the PersistenceManager is replaced during runtime (e.g.
> after registering, unregistering and registering again), the
> ConfigurationManager always re-initializes its list of PersistenceManagers.
> Thus, no caching is possible and configurations are loaded unnecessarily.
> Details: In the ConfigurationManager line 818 getTrackingCount() on the
> service tracker for PersistenceManagers is called. If the number returned is
> different to the number of currently known PersistenceManagers, then the list
> of PersistenceManagers is re-initialized. This works fine as long as the list
> of PersistenceManager increases. But if a PersistenceManager is unregistered,
> getTrackingCount() returns an increased number but the number of known
> PersistenceManagers is decreased. Thus, the if-condition in line 819 is
> always true, which causes a re-initialization of the list of known
> PersistenceManagers.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira