I am trying to understand how cake implements its multiple JVM approach. At a high level, I thought the cake worked similarly to nailgun, where there is one JVM instance (one JVM process), and the new "JVMs" for different projects were actually just clojure / jars evaluated in the new classloader (along with various dependencies jar), which in my eyes is not a new instance of the JVM. From What is the difference between Cake and Leiningen? , however, it is understood that there are several JVMs (one for cakes and * for projects), and not just one JVM Example.
If there are new JVM instances, where does the acceleration come from? From my point of view, I would believe that starting a new JVM involves creating a new JVM process that, as usual, will perform the same bootstraps.
If not, how are native dependencies added? As I understand it, the JVM only knows about its own dependencies on command-line arguments passed before execution. The only way I know how to get around this is to implement the JVM implementation described below for the Sun / Oracle implementation.
(let [clazz java.lang.ClassLoader
field (.getDeclaredField clazz "sys_paths")]
(.setAccessible field true)
(.set field clazz nil)
(System/setProperty "java.library.path" (apply str (interpose ";" native-paths))))
source
share