Using Clojure 1.4.0, I'm inspecting the classloader stack my software
is running with... and have at times noticed numerous layered
DynamicClassLoader instances:

(defn classloader-parents [loader]
  (when loader
    (lazy-seq (cons loader
                    (classloader-parents (.getParent loader))))))

=> (pprint (classloader-parents (.getContextClassLoader (Thread/
currentThread))))
(#<DynamicClassLoader clojure.lang.DynamicClassLoader@1b0c5fe9>
 #<DynamicClassLoader clojure.lang.DynamicClassLoader@78f92fba>
 #<ModuleClassLoader 94.0>
 #<WebappClassLoader WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@70eb7859
>
 #<StandardClassLoader
org.apache.catalina.loader.StandardClassLoader@70eb7859>
 #<AppClassLoader sun.misc.Launcher$AppClassLoader@4aad3ba4>
 #<ExtClassLoader sun.misc.Launcher$ExtClassLoader@3326b249>)

In this case it's only two DynamicClassLoader instances, but I've seen
it be much more, as eval unconditionally generates a new
DynamicClassLoader in all cases, since changeset
2c2ed386ed0f6f875342721bdaace908e298c7f3 (by rhickey in May 2010).
Unfortunately, this changeset doesn't include a ticket number or other
details on the bug it was intended to resolve.

Looking at the implementation, the immediate cause is obvious:
clojure.lang.RT.makeClassLoader() uses layers a new DynamicClassLoader
on top of baseLoader(), whatever that may be, and baseLoader() uses
clojure.lang.Compiler.LOADER, whenever that variable is bound, in
preference to anything else.

Does anyone know the issue that was behind this hotfix?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to