Hi,
I am newbie in quartz. And I need to start quartz schedular instance first. Then need to create jobs and triggers. And then need to attach them with the running quartz instance.
Following is First program which starz the schedular :
Code:
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
/**
* @author tamal
*
*/
public class QuartzTest {
/**
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
try {
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
System.out.println("Name"+scheduler.getSchedulerName());
System.out.println("ID"+scheduler.getSchedulerInstanceId());
scheduler.start();
Thread.sleep(20000); // Sleep 20 second
System.out.println("Sleeping");
scheduler.shutdown();
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Now I want to access this same schedular from another java program running on same JVM
Code:
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
/**
* @author Tamal
*
*/
public class ClientQuartz {
public static void main(String[] args) throws SchedulerException{
Scheduler scheduler1 = StdSchedulerFactory.getDefaultScheduler();
System.out.println("ID"+scheduler1.getSchedulerInstanceId());
System.out.println("Name"+scheduler1.getSchedulerName());
System.out.println("Is Shutdown??"+scheduler1.isShutdown());
System.out.println("Is Started??"+scheduler1.isStarted());
//scheduler1.
}
}
Following is Quartz.properties file
Code:
org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
But I am not getting the status of running scheduler from send program.
Can anybody please help.