Is using reify to implement org.quartz.Job still a problem?

47 views
Skip to first unread message

Neale Swinnerton

unread,
May 21, 2013, 9:08:48 AM5/21/13
to clojure...@googlegroups.com
Hi,

Digging in the source of defjob I noticed a comment  about clojure.core/reify not working to implement org.quartz.Job.[1]

Is this still true? I reworked one of the getting starting examples to use reify instead of defjob and it seems to work fine [2]. 

Am I missing something? I'm using clojure 1.5.1, java 1.7.0_13 on OSX Lion

Michael Klishin

unread,
May 21, 2013, 10:14:20 AM5/21/13
to clojure...@googlegroups.com
2013/5/21 Neale Swinnerton <ne...@isismanor.com>
Is this still true?

AFAIR, this job won't load during execution because Quartz has certain assumptions about classloaders.
--
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

Neale Swinnerton

unread,
May 21, 2013, 10:23:19 AM5/21/13
to clojure...@googlegroups.com

On Tue, May 21, 2013 at 3:14 PM, Michael Klishin <michael....@gmail.com> wrote
AFAIR, this job won't load during execution because Quartz has certain assumptions about classloaders.

The example in the gist works fine, but I have a more complex example that fails with InstantiationException. Not sure why. I wonder if a clojure.lang.DynamicClassLoader aware JobFactory might solve the problem. 

Michael Klishin

unread,
May 21, 2013, 10:25:38 AM5/21/13
to clojure...@googlegroups.com

2013/5/21 Neale Swinnerton <ne...@isismanor.com>

The example in the gist works fine, but I have a more complex example that fails with InstantiationException. Not sure why. I wonder if a clojure.lang.DynamicClassLoader aware JobFactory might solve the problem. 

Yes and that's how I solved it in my apps but this is now such a great idea for a library.

Do you have any specific reasons to need to use reify (besides defrecord not really being meant to be used that way)?

Neale Swinnerton

unread,
May 21, 2013, 10:32:19 AM5/21/13
to clojure...@googlegroups.com
On Tue, May 21, 2013 at 3:25 PM, Michael Klishin <michael....@gmail.com> wrote:

Do you have any specific reasons to need to use reify (besides defrecord not really being meant to be used that way)?

I'm dynamically creating the jobs based on config, as a workaround I'm looking at having a single job defined that takes parameters via job ctx, which looks OK, but it would be nice  to understand what's stopping reify working. 
 

Michael Klishin

unread,
May 21, 2013, 10:41:52 AM5/21/13
to clojure...@googlegroups.com

2013/5/21 Neale Swinnerton <ne...@isismanor.com>

but it would be nice  to understand what's stopping reify working.

Rake a look at JobDetail#getJobClass. Quartz itself dynamically instantiates
some parts using a separate classloader. Overriding classloader used to load job looks like this:

Michael Klishin

unread,
May 21, 2013, 10:58:42 AM5/21/13
to clojure...@googlegroups.com

2013/5/21 Michael Klishin <michael....@gmail.com>
Rake a look at JobDetail#getJobClass

To spare you some time looking for a Quartz mirror on github, I'm afraid the repo
is only available in Subversion: http://quartz-scheduler.org/community/source-code
and I could not find a Web interface.

C'est la vie.

Michael Klishin

unread,
May 21, 2013, 11:01:28 AM5/21/13
to clojure...@googlegroups.com

2013/5/21 Michael Klishin <michael....@gmail.com>

I could not find a Web interface

Now they seem to have FishEye that does not timeout

Neale Swinnerton

unread,
May 21, 2013, 11:18:18 AM5/21/13
to clojure...@googlegroups.com
On Tue, May 21, 2013 at 4:01 PM, Michael Klishin <michael....@gmail.com> wrote:
Now they seem to have FishEye that does not timeout
but asks for credentials ;?

same for me, I just took the hit and pulled down the code via svn :/ 
Reply all
Reply to author
Forward
0 new messages