// java class
----------------------------------------------------------------------------------------------------
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
public class MyScheduler
{
public void task() throws SchedulerException
{
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
sched.start();
}
}
//quartz.properties
------------------------------------------------------------------------------------------------------
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
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = scheduler.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = true
//schedule.xml
---------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<quartz>
<job>
<job-detail>
<name>IndexFileCreate</name>
<group>group1</group>
<job-class>linno.index.schedule.IndexJob</job-class>
<job-data-map>
<entry>
<key>configFilePath</key>
<value>indexer.xml</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>IndexFileCreateTrigger</name>
<group>group1</group>
<job-name>IndexFileCreate</job-name>
<job-group>group1</job-group>
<!--
Field Name Mandatory? Allowed Values Allowed Special Characters
Seconds YES 0-59 , - * /
Minutes YES 0-59 , - * /
Hours YES 0-23 , - * /
Day of month YES 1-31 , - * ? / L W C
Month YES 1-12 or JAN-DEC , - * /
Day of week YES 1-7 or SUN-SAT , - * ? / L C #
Year NO empty, 1970-2099 , - * /
-->
<!--
0 0 0/1 * * ?
every one hour of every day
-->
<cron-expression>0 0 0/1 * * ?</cron-expression>
</cron>
</trigger>
</job>
<job>
<job-detail>
<name>NewIndexFileCreate</name>
<group>group1</group>
<job-class>linno.index.schedule.NewIndexJob</job-class>
<job-data-map>
<entry>
<key>configFilePath</key>
<value>indexer.xml</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>NewIndexFileCreateTrigger</name>
<group>group1</group>
<job-name>NewIndexFileCreate</job-name>
<job-group>group1</job-group>
<cron-expression>0 0 2 ? * 1</cron-expression>
</cron>
</trigger>
</job>
</quartz>
----------------------------------------------------------------------------------------------------
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;
public class MyScheduler
{
public void task() throws SchedulerException
{
SchedulerFactory sf = new StdSchedulerFactory();
Scheduler sched = sf.getScheduler();
sched.start();
}
}
//quartz.properties
------------------------------------------------------------------------------------------------------
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
org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingTriggerHistoryPlugin
org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger {1}.{0} fired job {6}.{5} at: {4, date, HH:mm:ss MM/dd/yyyy}
org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger {1}.{0} completed firing job {6}.{5} at {4, date, HH:mm:ss MM/dd/yyyy} with resulting trigger instruction code: {9}
org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = scheduler.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = true
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin
org.quartz.plugin.shutdownhook.cleanShutdown = true
//schedule.xml
---------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<quartz>
<job>
<job-detail>
<name>IndexFileCreate</name>
<group>group1</group>
<job-class>linno.index.schedule.IndexJob</job-class>
<job-data-map>
<entry>
<key>configFilePath</key>
<value>indexer.xml</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>IndexFileCreateTrigger</name>
<group>group1</group>
<job-name>IndexFileCreate</job-name>
<job-group>group1</job-group>
<!--
Field Name Mandatory? Allowed Values Allowed Special Characters
Seconds YES 0-59 , - * /
Minutes YES 0-59 , - * /
Hours YES 0-23 , - * /
Day of month YES 1-31 , - * ? / L W C
Month YES 1-12 or JAN-DEC , - * /
Day of week YES 1-7 or SUN-SAT , - * ? / L C #
Year NO empty, 1970-2099 , - * /
-->
<!--
0 0 0/1 * * ?
every one hour of every day
-->
<cron-expression>0 0 0/1 * * ?</cron-expression>
</cron>
</trigger>
</job>
<job>
<job-detail>
<name>NewIndexFileCreate</name>
<group>group1</group>
<job-class>linno.index.schedule.NewIndexJob</job-class>
<job-data-map>
<entry>
<key>configFilePath</key>
<value>indexer.xml</value>
</entry>
</job-data-map>
</job-detail>
<trigger>
<cron>
<name>NewIndexFileCreateTrigger</name>
<group>group1</group>
<job-name>NewIndexFileCreate</job-name>
<job-group>group1</job-group>
<cron-expression>0 0 2 ? * 1</cron-expression>
</cron>
</trigger>
</job>
</quartz>