Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clojure implementation of DynamicClassLoadHelper #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions articles/durable_quartz_stores.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,25 @@ To allow Quartz to see classes the Clojure compiler generates, we must provide a
custom implementation of the ClassLoadHelper class which Quartz uses for
discovering classes. A working implementation is below:

``` java
// Example package
package oceania.myservice.quartz;
```clj
;; example namespace
(ns oceania.myservice.quartz.DynamicClassLoadHelper
(:gen-class
:extends clojure.lang.DynamicClassLoader
:exposes-methods {loadClass superLoadClass}
:implements [org.quartz.spi.ClassLoadHelper]))

import clojure.lang.DynamicClassLoader;
import org.quartz.spi.ClassLoadHelper;
(defn -initialize [_])

public class DynamicClassLoadHelper extends DynamicClassLoader implements ClassLoadHelper {
public void initialize() {}
(defn -loadClass
([^oceania.myservice.quartz.DynamicClassLoadHelper this, ^String class-name]
(.superLoadClass this class-name true)) ; loadClass(String name, boolean resolve)
([^oceania.myservice.quartz.DynamicClassLoadHelper this, ^String class-name, _]
(.superLoadClass this class-name true)))

@SuppressWarnings("unchecked")
public <T> Class<? extends T> loadClass(String name, Class<T> clazz)
throws ClassNotFoundException {
return (Class<? extends T>) loadClass(name);
}
(defn -getClassLoader [this]
this)

public ClassLoader getClassLoader() {
return this;
}
}
```


Expand Down