Getting Started with Quartz

Source: Internet
Author: User

what quartz is.

Quartz is a full-featured, open source job scheduler that quartz can be integrated into any Java EE or J2SE program (from the smallest stand-alone program to a complex e-business system). Quartz can manage even, hundreds of, or even thousands of simple or complex job schedules. These jobs can be any standard Java component or EJB. Quartz Job scheduling system contains a lot of enterprise-class characteristics, such as: JTA transactions, clustering and so on.

Quartz characteristics

First, the operating environment

Quartz can be embedded in other programs that you run

Quartz can be initialized within an application server (or Web server) and can participate in XA transactions (distributed transactions, two-phase commits).

Quartz can be run as a separate Java program (run in a separate Java Virtual machine process) and can be used remotely via RMI

Quartz can be run in a distributed manner (this can take advantage of load balancing and automatic fault tolerance)

Second, job scheduling

When a trigger occurs, the job is scheduled to execute. The trigger uses nearly all of the following instructions for the Union.

A time of day (Microsecond level)

Some days of the week

Some days in the January

Some days of the year

Some days in the calendar that is not registered

Repeated several times

Repeat the instructions for a time

An indeterminate repetition.

Repeat after a certain amount of time

Jobs can be named by the creator, or they can be organized into named groups. Triggers can also be named or grouped so that these triggers can be easily managed in the scheduler. A job can be registered in the scheduler once, but multiple triggers are used. The contents of the job in the Java EE Environment can participate in a distributed transaction (XA Transaction).

Third, job execution

A job can be any Java class that implements the job interface, and any content you want to implement can be implemented in a job.

The job can be quartz instantiated, or it can be instantiated by your program.

When a trigger occurs, the scheduler triggers Joblistener or Triggerlistener instances, which can be simple Java objects, EJB,JMS publishers, and so on. These listener are also triggered after the job execution ends.

When the job completes, it returns a Jobcompletioncode object that contains information about the execution success or failure. Jobcompletioncode can also instruct scheduler to perform those jobs that need to be executed dynamically based on the results of this job.

Four, the job is persisted

The quartz design includes a jobstore interface that enables you to implement Jobstore interfaces to store jobs in different ways.

Using Jdbcjobstroe, stable jobs and triggers can be stored in the database through JDBC.

You can use Ramjobstore to place jobs and triggers in memory so that they are lost at the end of each execution, but you do not need to use an external database.

Five, the business

You can participate in a JTA transaction by using the JOBSTORECMT (Jdbcjobstore subclass). (Participates in other JTA transactions by registering the job)

Quartz can manage JTA transactions (start or commit transactions) at the start or end of a job, so that the job can be executed in the context of the transaction.

VI, cluster

Fault tolerant

Cluster

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.