Liking cljdoc? Tell your friends :D

tservice-core.plugins.classloader

Logic for getting and setting the context classloader we'll use for loading tservice plugins. Use the-classloader to get the Classloader you should use with calls to Class/forName; call it for side effects to ensure the current thread context classloader will have access to JARs we add at runtime before calling require.

The classloader is guaranteed to be an instance of DynamicClassLoader, which means we can add URLs to it at runtime with dynapath; use add-url-to-classpath! to add URLs to the classpath to make sure they are added to the correct classloader.

If you are unfamiliar with ClassLoaders in general, I found this article pretty helpful: https://www.javaworld.com/article/2077344/core-java/find-a-way-out-of-the-classloader-maze.html.

Logic for getting and setting the context classloader we'll use for loading tservice plugins. Use `the-classloader`
to get the Classloader you should use with calls to `Class/forName`; call it for side effects to ensure the current
thread context classloader will have access to JARs we add at runtime before calling `require`.

The classloader is guaranteed to be an instance of `DynamicClassLoader`, which means we can add URLs to it at
runtime with dynapath; use `add-url-to-classpath!` to add URLs to the classpath to make sure they are added to the
correct classloader.

If you are unfamiliar with ClassLoaders in general, I found this article pretty helpful:
https://www.javaworld.com/article/2077344/core-java/find-a-way-out-of-the-classloader-maze.html.
raw docstring

add-url-to-classpath!clj

(add-url-to-classpath! url)

Add a URL (presumably for a local JAR) to the classpath.

Add a URL (presumably for a local JAR) to the classpath.
raw docstring

requireclj

(require & args)

Just like vanilla require, but ensures we're using our shared classloader to do it. Always use this over vanilla require -- otherwise namespaces might get loaded by the wrong ClassLoader, resulting in weird, hard-to-debug errors.

Just like vanilla `require`, but ensures we're using our shared classloader to do it. Always use this over vanilla
`require` -- otherwise namespaces might get loaded by the wrong ClassLoader, resulting in weird, hard-to-debug
errors.
raw docstring

the-classloaderclj

(the-classloader)

Fetch the context classloader for the current thread; ensure it has a our shared context classloader as an ancestor somewhere in its hierarchy, changing the thread's context classloader when needed.

This function should be used when loading classes (such as JDBC drivers) with Class/forName; and for side-effects before calling require, to ensure the context classloader for the current thread is one that has access to the JARs we've added to the classpath.

Fetch the context classloader for the current thread; ensure it has a our shared context classloader as an ancestor
somewhere in its hierarchy, changing the thread's context classloader when needed.

This function should be used when loading classes (such as JDBC drivers) with `Class/forName`; and for side-effects
before calling `require`, to ensure the context classloader for the current thread is one that has access to the JARs
we've added to the classpath.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close