You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2010/01/18 15:34:56 UTC

svn commit: r900409 - /sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java

Author: bdelacretaz
Date: Mon Jan 18 14:34:55 2010
New Revision: 900409

URL: http://svn.apache.org/viewvc?rev=900409&view=rev
Log:
SLING-1288 - OSGi Installer did not cleanup RegisteredResourceImpl temp files

Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java?rev=900409&r1=900408&r2=900409&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerThread.java Mon Jan 18 14:34:55 2010
@@ -266,6 +266,14 @@
                 // If an object with same sort key is already present, replace with the
                 // new one which might have different attributes
                 if(t.contains(r)) {
+                	for(RegisteredResource rr : t) {
+                		if(t.comparator().compare(rr, r) == 0) {
+                			if(ctx.getLogService()!= null) {
+                				ctx.getLogService().log(LogService.LOG_DEBUG, "Cleanup obsolete " + rr);
+                			}
+                			rr.cleanup(ctx.getBundleContext());
+                		}
+                	}
                     t.remove(r);
                 }
                 t.add(r);
@@ -353,7 +361,7 @@
         return counter;
     }
     
-    private void cleanupInstallableResources() {
+    private void cleanupInstallableResources() throws IOException {
         // Cleanup resources that are not marked installable,
         // they have been processed by now
         int resourceCount = 0;
@@ -389,6 +397,9 @@
         ctx.setCounter(OsgiInstaller.REGISTERED_RESOURCES_COUNTER, resourceCount);
         ctx.setCounter(OsgiInstaller.REGISTERED_GROUPS_COUNTER, registeredResources.size());
         ctx.incrementCounter(OsgiInstaller.INSTALLER_CYCLES_COUNTER);
+        
+        // List of resources might have changed
+        persistentList.save();
     }
     
     /** If we have any tasks waiting to be retried, schedule their execution */