[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
JobDetails Class  XML
Forum Index -> Quartz
Author Message
sherry

neo

Joined: 01/21/2010 04:25:43
Messages: 5
Offline

Hi,
I am new to Quartz and I have some questions .
as far as I know scheduler.start actually create instance of jobclass and then invoke execute method of it , is their any way where i can pass instance of job class instead of Class reference.


I want to avoid too many instance creation of my class because I want to add several method of that class in job .


What I meant is

Class Node implements Job {

public void execute(.....) {
}
}

Class Test {

public static void main(String arg[]){
JobDetail jd = new JobDetail(Node.class);

Sched.start() ----------------------------> will create one instance per jobDetail



}

}

Now when I will pass
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


You may be interested in implementing your own JobFactory and specifying Quartz use it within your quartz.properties.
sherry

neo

Joined: 01/21/2010 04:25:43
Messages: 5
Offline

any example where I can see how do I write my own JobFactory class
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


There are a couple in Quartz's code base, and at least one in Spring's code base.

I don't know of any written/guided example.

It's rather easy though: just implement the simple JobFactory interface to produce your instance (or hand a recurring instance to Quartz), then set one line of config in your Quartz properties to name your job factory class.

Code:
 org.quartz.scheduler.jobFactory.class: com.foo.MyJobFactory
 
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team