public class ClojureOSGi {
private static volatile boolean initialized;
private synchronized static void initialize() {
if (initialized) return;
CCWPlugin plugin = CCWPlugin.getDefault();
if (plugin == null) {
System.out.println("======= ClojureOSGi.initialize will fail because ccw.core plugin not activated yet");
System.out.flush();
}
ClassLoader loader = new BundleClassLoader(plugin.getBundle());
ClassLoader saved = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(loader);
Class.forName("clojure.lang.RT", true, loader); // very important, uses the right classloader
CCWPlugin.getTracer().trace(TraceOptions.CLOJURE_OSGI, "namespace clojure.core loaded");