Quartz Open source Scheduler Basic Schedulers in Java Install Quartz for JAva

Quartz scheduler for java

Quartz is an open source scheduler for java applications.It is a full-featured job scheduling service which can be intergrated with any java application whether web based or console.Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs.The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering and many more.

How to install Quartz :

Download the quartz latest stable release from the link http://www.terracotta.org/dl/quartz-oss-sign-up .

For linux it will be zipper tar file which can be extracted.The Quartz package includes a number of jar files.The main Quartz library is named quartz-all-version.jar . In order to use any of Quartz’s features, this jar must be located on your application’s classpath.Basically we need to include all the jar files in the “lib” folder and other jar files to be included in the project`s classpath.

Quartz contains a number of third party librarries which are available in the form of jar files inside the “lib” folder.When we are devloping any web application or enterprise application,we need to add these jar files in projects library.

The properties file :

Quartz uses “quartz.properties” file to store all the configuration details,thus making quartz highly configurable.All details such as sceduler name,number of threads etc can be mentioned here within this file.The properties file appears like :

org.quartz.scheduler.instanceName = SchedulerName
org.quartz.scheduler.instanceId = 1
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5

org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

The sample Code :
Once we have included all the jar files we can use quartz scheduling in our project.
The sample code is as follows :

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
ipport org.quartz.impl.StdSchedulerFactory;

public class QuartzTest {
    public static void main(String[] args) {
        try {
            // Obtain the Scheduler from the Factory as an instance
            Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

            // start scheduler
               //write jobs here

        } catch (SchedulerException se) {

We can schedule the jobs writing the job scheduling code within scheduler.start() and scheduler.shutdown() function calls.

Number of View :5794


  1. #1 written by admin October 12th, 2010 at 11:08

    sample java code using quartz threadpool

    RE Q
    • #2 written by admin October 14th, 2010 at 04:56

      quartz threadpool sample code.

      RE Q

Content Protected Using Blog Protector By: PcDrome.