aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1126406 - /aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
Date Mon, 23 May 2011 09:40:36 GMT
Author: not
Date: Mon May 23 09:40:36 2011
New Revision: 1126406

URL: http://svn.apache.org/viewvc?rev=1126406&view=rev
Log:
ARIES-292 Add a hacky fix that will force the JVM to release locks on the eba.


Modified:
    aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java

Modified: aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java?rev=1126406&r1=1126405&r2=1126406&view=diff
==============================================================================
--- aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
(original)
+++ aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
Mon May 23 09:40:36 2011
@@ -24,6 +24,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Dictionary;
@@ -320,6 +322,28 @@ public class AriesApplicationManagerImpl
     }
   
     AriesApplicationContext result = _applicationContextManager.getApplicationContext(app);
+    
+    // When installing bundles in the .eba file we use the jar url scheme. This results in
a
+    // JarFile being held open, which is bad as on windows we cannot delete the .eba file
+    // so as a work around we open a url connection to one of the bundles in the eba and
+    // if it is a jar url we close the associated JarFile.
+    
+    Iterator<BundleInfo> bi = app.getBundleInfo().iterator();
+    
+    if (bi.hasNext()) {
+      String location = bi.next().getLocation();
+      if (location.startsWith("jar")) {
+        try {
+          URL url = new URL(location);
+          JarURLConnection urlc = (JarURLConnection) url.openConnection();
+          urlc.getJarFile().close();
+        } catch (IOException e) {
+          // TODO Auto-generated catch block
+          e.printStackTrace();
+        }
+      }
+    }
+    
     return result;
   }
   



Mime
View raw message