incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r794540 - /sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
Date Thu, 16 Jul 2009 05:46:47 GMT
Author: cziegeler
Date: Thu Jul 16 05:46:47 2009
New Revision: 794540

URL: http://svn.apache.org/viewvc?rev=794540&view=rev
Log:
Use provided parent class loader instead of own class loader

Modified:
    sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java

Modified: sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java?rev=794540&r1=794539&r2=794540&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
(original)
+++ sling/trunk/bundles/jcr/classloader/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
Thu Jul 16 05:46:47 2009
@@ -117,10 +117,23 @@
     }
 
     /**
-     * @see org.apache.sling.commons.classloader.DynamicClassLoaderProvider#getClassLoader()
+     * @see org.apache.sling.commons.classloader.DynamicClassLoaderProvider#getClassLoader(ClassLoader)
      */
-    public ClassLoader getClassLoader() {
-        return this.getClassLoader(null);
+    public ClassLoader getClassLoader(final ClassLoader parent) {
+        // we just make up a unique identifier
+        final String classLoaderOwner = "DynamicClassLoaderProvider:" + parent.hashCode();
+        RepositoryClassLoaderFacade loader =
+            (RepositoryClassLoaderFacade) this.loaders.get(classLoaderOwner);
+        if (loader == null) {
+            loader = new RepositoryClassLoaderFacade(this, parent,
+                    OWNER_DEFAULT, this.classPath);
+            this.loaders.put(classLoaderOwner, loader);
+        }
+
+        // extend reference counter
+        loader.ref();
+
+        return loader;
     }
 
     //---------- SCR Integration ----------------------------------------------



Mime
View raw message