tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: close classloader is not part of j6
Date Tue, 06 Jan 2015 14:50:28 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 860a1aed8 -> d00201397


close classloader is not part of j6


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d0020139
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d0020139
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d0020139

Branch: refs/heads/tomee-1.7.x
Commit: d00201397859bd321877490bb64440faeacaaf69
Parents: 860a1ae
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Tue Jan 6 15:50:20 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Tue Jan 6 15:50:20 2015 +0100

----------------------------------------------------------------------
 .../config/ConfigurableClasspathArchive.java     | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d0020139/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
index 938f1c9..8378dca 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurableClasspathArchive.java
@@ -29,6 +29,7 @@ import org.apache.xbean.finder.filter.FilterList;
 import org.apache.xbean.finder.filter.PackageFilter;
 
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
@@ -39,6 +40,16 @@ import java.util.Map;
 import java.util.Set;
 
 public class ConfigurableClasspathArchive extends CompositeArchive implements ScanConstants
{
+    private static final Method CLOSE_LOADER;
+    static {
+        Method m = null;
+        try {
+            m = URLClassLoader.class.getMethod("close");
+        } catch (final Throwable e) {
+            // no-op
+        }
+        CLOSE_LOADER = m;
+    }
     public ConfigurableClasspathArchive(final Module module, final URL... urls) {
         this(module, Arrays.asList(urls));
     }
@@ -81,7 +92,13 @@ public class ConfigurableClasspathArchive extends CompositeArchive implements
Sc
         try {
             final URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{location},
new EmptyResourcesClassLoader());
             final URL scanXml = urlClassLoader.getResource(name);
-            urlClassLoader.close();
+            if (CLOSE_LOADER != null) {
+                try {
+                    CLOSE_LOADER.invoke(urlClassLoader);
+                } catch (final Throwable ignored) {
+                    // no-op
+                }
+            }
 
             if (scanXml == null && !forceDescriptor) {
                 return ClasspathArchive.archive(loader, location);


Mime
View raw message