Documente Academic
Documente Profesional
Documente Cultură
Version 2.2.1
This document applies to Quar Scheduler Version 2.2.1 and to all subsequent releases.
Specications contained herein are subject to change and these changes will be reported in subsequent release notes or new editions.
Copyright 2014 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its
aliates and/or their licensors.
The name Software AG and all Software AG product names are either trademarks or registered trademarks of Software AG and/or
Software AG USA Inc. and/or its subsidiaries and/or its aliates and/or their licensors. Other company and product names mentioned
herein may be trademarks of their respective owners.
Detailed information on trademarks and patents owned by Software AG and/or its subsidiaries is located at
hp://documentation.softwareag.com/legal/.
Use of this software is subject to adherence to Software AG's licensing conditions and terms. These terms are part of the product
documentation, located at hp://documentation.softwareag.com/legal/ and/or in the root installation directory of the licensed product(s).
This software may include portions of third-party products. For third-party copyright notices and license terms, please refer to "License
Texts, Copyright Notices and Disclaimers of Third Party Products. This document is part of the product documentation, located at
hp://documentation.softwareag.com/legal/ and/or in the root installation directory of the licensed product(s).
Document ID: QS-GS-221-20141015
M
Table of Contents
Table of Contents
About Quartz Scheduler..................................................................................................................5
What is Quartz Scheduler?........................................................................................................ 6
Quartz Features..........................................................................................................................6
Installing and Using Quartz Scheduler......................................................................................... 9
Downloading and Installing Quartz...........................................................................................10
Configuring Quartz Scheduler.................................................................................................. 11
Starting a Sample Application.................................................................................................. 11
Even Header
Odd Header
About Quartz Scheduler
Even Header
About Quartz Scheduler
Quartz Features
Runtime Environments
Quar can run embedded within another free standing application
Quar can be instantiated within an application server (or servlet container), and
participate in XA transactions
Quar can run as a stand-alone program (within its own Java Virtual Machine), to
be used via RMI
Quar can be instantiated as a cluster of stand-alone programs (with load-balance
and fail-over capabilities) for the execution of jobs
Job Scheduling
Jobs are scheduled to run when a given trigger occurs. Triggers can be created with
nearly any combination of the following directives:
At a certain time of day (to the millisecond)
On certain days of the week
Odd Header
About Quartz Scheduler
Even Header
About Quartz Scheduler
Quar can manage JTA transactions (begin and commit them) around the execution
of a job, so that the work performed by the Job automatically happens within a JTA
transaction.
Clustering Features
Provides fail-over.
Provides load balancing.
Quar's built-in clustering features rely upon database persistence via JDBCJobStore
(described above).
Terracoa extensions to Quar provide clustering capabilities without the need for a
back-end database.
Listeners & Plug-Ins
Applications can catch scheduling events to monitor or control job/trigger behavior
by implementing one or more listener interfaces.
The Plug-In mechanism can be used add functionality to Quar, such keeping a
history of job executions, or loading job and trigger denitions from a le.
Quar ships with a number of "factory built" plug-ins and listeners.
Odd Header
Installing and Using Quartz Scheduler
10
11
11
Even Header
Installing and Using Quartz Scheduler
10
Odd Header
Installing and Using Quartz Scheduler
org.quartz.Scheduler;
org.quartz.SchedulerException;
org.quartz.impl.StdSchedulerFactory;
static org.quartz.JobBuilder.*;
static org.quartz.TriggerBuilder.*;
static org.quartz.SimpleScheduleBuilder.*;
11
Even Header
Installing and Using Quartz Scheduler
To do something, you need to provide code between the start() and shutdown()
calls. You will also need to allow some time for the job to be triggered and
executed before calling shutdown(). For a simple example like this, you might call
Thread.sleep(60000).
// define the job and tie it to our HelloJob class
JobDetail job = newJob(HelloJob.class)
.withIdentity("job1", "group1")
.build();
// Trigger the job to run now, and then repeat every 40 seconds
Trigger trigger = newTrigger()
.withIdentity("trigger1", "group1")
.startNow()
.withSchedule(simpleSchedule()
.withIntervalInSeconds(40)
.repeatForever())
.build();
// Tell quartz to schedule the job using our trigger
scheduler.scheduleJob(job, trigger);
For additional code samples, see Quar Scheduler Example Programs and Code Samples.
12