Created
November 7, 2013 13:36
-
-
Save mrrodriguez/7354670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have some Clojure clj files in a jar called A.jar. | |
This jar is started up, and I see that all of the clj files are loaded by the Application ClassLoader, along with the rest of the classes in the jar. | |
At runtime a new jar is added to the classpath, with some clj files that `require`s some of the clj files already loaded by the App ClassLoader. | |
What I have observed is that, when this newly added jar's clj files are being loaded, the `require`s they have on already loaded clj classes, are causing them to be reloaded. | |
The issue is that if these files that are reloaded, have something like `defrecord` in them, they load a new "version" of the same class, with a different classloader. | |
Where this has caused troubles for me, is I can not do something like `instance?` on a `defrecord` type class, if the object I'm looking at came from the dynamically loaded jar. | |
Is this the expected behavior? I thought that `require` would detect that the clj has already been loaded in the RT by the App ClassLoader, so it would not reload it, unless specifically directed to by :reload or :reload-all. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment