You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2013/09/25 15:54:03 UTC

[jira] [Comment Edited] (FELIX-4238) Unnecessary re-initialization of PersistenceManagers in configadmin

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

Felix Meschberger edited comment on FELIX-4238 at 9/25/13 1:52 PM:
-------------------------------------------------------------------

Woot ! You find a nice one. Thank you very much.

The fix is as simple as:

{noformat}
Index: ConfigurationManager.java
===================================================================
--- ConfigurationManager.java	(Revision 1524907)
+++ ConfigurationManager.java	(Arbeitskopie)
@@ -848,7 +848,7 @@
                 pm = ( PersistenceManager[] ) pmList.toArray( new PersistenceManager[pmList.size()] );
             }
 
-            pmtCount = pm.length;
+            pmtCount = currentPmtCount;
             persistenceManagers = pm;
         }
 
{noformat}

                
      was (Author: fmeschbe):
    Woot ! You find a nice one. Thank you very much.

The fix is as simple as:

Index: ConfigurationManager.java
===================================================================
--- ConfigurationManager.java	(Revision 1524907)
+++ ConfigurationManager.java	(Arbeitskopie)
@@ -848,7 +848,7 @@
                 pm = ( PersistenceManager[] ) pmList.toArray( new PersistenceManager[pmList.size()] );
             }
 
-            pmtCount = pm.length;
+            pmtCount = currentPmtCount;
             persistenceManagers = pm;
         }
 

                  
> 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
>            Assignee: Felix Meschberger
>            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