zoukankan      html  css  js  c++  java
  • 一)get started with the Quartz project

    官网 http://www.quartz-scheduler.org/

    下载链接 http://www.terracotta.org/download/reflector.jsp?b=tcdistributions&i=quartz-2.2.2-distribution.tar.gz

    提示 开源产品的文档和demo都很充足

    README.txt

    ==============================================================================
    This file is intended to help you get started with the Quartz project.
    
    For more information see http://www.quartz-scheduler.org
    ==============================================================================
    
    
    What is Quartz?
    ==============================================================================
    
    Quartz is an open source project aimed at creating a free-for-use Job 
    Scheduler, with enterprise features.
    
    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License. You may obtain a copy
    of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
    Additionally, a copy of the license and its accompanying notice file is
    included with the distribution.
    
    
    What is in this package?
    ==============================================================================
    
    lib                         a directory which should contain all of the
                                third-party libraries that are needed in order
                                to use all of the features of Quartz.
                                
      + quartz-<ver>.jar        Quartz library.
    
    samples                    a directory containing some code samples on the
                                usage of Quartz.  The first example you should
                                look at is 'example1.bat' or 'example1.sh' -
                                depending if you're a win-dos or unix person.
                                This example uses the code found in the
                                SchedTest.java class, which is also in the
                                examples directory.
    
    
    
    
    
    Where should I start if I am new to Quartz?
    ==============================================================================
    
    There is an FAQ, tutorial and configuration reference that can be found on the 
    main Quartz website at http://quartz-scheduler.org/docs/index.html
    
    Most of the Java source files are fairly well documented with JavaDOC -
    consider this your "reference manual".  
    
    Start by looking at org.quartz.Scheduler, org.quartz.Job,
    org.quartz.JobDetail and org.quartz.Trigger.
    
    Examine and run the examples found in the "examples" directory.
    
    If you're interested in the "behind the scenes" (server-side) code,
    you'll want to look at org.quartz.core.QuartzSchedulerThread, which
    will make you interested in org.quartz.spi.JobStore.java,
    org.quartz.spi.ThreadPool.java and org.quartz.core.JobRunShell.
    
    
    What should I do if I encounter a problem?
    ==============================================================================
    
    Help is available via the Quartz Users forum:
    
      http://forums.terracotta.org/forums/forums/show/17.page
    
    Please report bugs / issues to JIRA at:
    
      https://jira.terracotta.org/jira/browse/QTZ
    
    
    How can I get started with the Terracotta Job Store?
    ==============================================================================
    
    The Terracotta Job Store provides an easy way to implement a highly 
    available, highly scalable, and durable way to schedule jobs across 
    multiple nodes. As with other Terracotta solutions, Quartz clustering 
    can be achieved via Terracotta Job Store. Configure your app to use 
    the Terracotta Job Store by setting the following in your quartz.properties file 
    (or set these properties directly within the application)
    
        org.quartz.jobStore.class = org.terracotta.quartz.TerracottaJobStore
        org.quartz.jobStore.tcConfigUrl = localhost:9510
    
    This assumes that you are running the Terracotta server on the localhost 
    (which can be started using the bin/start-tc-server.[sh|bat] script). If 
    not, replace localhost as appropriate. The Terracotta Job Store requires 
    Terracotta 3.2.0 or greater.

    SQL

    %quartz_home%docsdbTables ables_oracle.sql 

        tables_cloudscape.sql
        tables_cubrid.sql
        tables_db2.sql
        tables_db2_v72.sql
        tables_db2_v8.sql
        tables_db2_v95.sql
        tables_derby.sql
        tables_derby_previous.sql
        tables_firebird.sql
        tables_h2.sql
        tables_hsqldb.sql
        tables_hsqldb_old.sql
        tables_informix.sql
        tables_mysql.sql
        tables_mysql_innodb.sql
        tables_oracle.sql
        tables_pointbase.sql
        tables_postgres.sql
        tables_sapdb.sql
        tables_solid.sql
        tables_sqlServer.sql
        tables_sybase.sql

    tables_oracle.sql  自行替换为自己的系统前缀(由quartz.properties定义) 如:qrtz -> qsmse

    --
    -- A hint submitted by a user: Oracle DB MUST be created as "shared" and the 
    -- job_queue_processes parameter  must be greater than 2
    -- However, these settings are pretty much standard after any
    -- Oracle install, so most users need not worry about this.
    --
    -- Many other users (including the primary author of Quartz) have had success
    -- runing in dedicated mode, so only consider the above as a hint ;-)
    --
    
    delete from qrtz_fired_triggers;
    delete from qrtz_simple_triggers;
    delete from qrtz_simprop_triggers;
    delete from qrtz_cron_triggers;
    delete from qrtz_blob_triggers;
    delete from qrtz_triggers;
    delete from qrtz_job_details;
    delete from qrtz_calendars;
    delete from qrtz_paused_trigger_grps;
    delete from qrtz_locks;
    delete from qrtz_scheduler_state;
    
    drop table qrtz_calendars;
    drop table qrtz_fired_triggers;
    drop table qrtz_blob_triggers;
    drop table qrtz_cron_triggers;
    drop table qrtz_simple_triggers;
    drop table qrtz_simprop_triggers;
    drop table qrtz_triggers;
    drop table qrtz_job_details;
    drop table qrtz_paused_trigger_grps;
    drop table qrtz_locks;
    drop table qrtz_scheduler_state;
    
    
    CREATE TABLE qrtz_job_details
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        JOB_NAME  VARCHAR2(200) NOT NULL,
        JOB_GROUP VARCHAR2(200) NOT NULL,
        DESCRIPTION VARCHAR2(250) NULL,
        JOB_CLASS_NAME   VARCHAR2(250) NOT NULL, 
        IS_DURABLE VARCHAR2(1) NOT NULL,
        IS_NONCONCURRENT VARCHAR2(1) NOT NULL,
        IS_UPDATE_DATA VARCHAR2(1) NOT NULL,
        REQUESTS_RECOVERY VARCHAR2(1) NOT NULL,
        JOB_DATA BLOB NULL,
        CONSTRAINT QRTZ_JOB_DETAILS_PK PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
    );
    CREATE TABLE qrtz_triggers
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        JOB_NAME  VARCHAR2(200) NOT NULL, 
        JOB_GROUP VARCHAR2(200) NOT NULL,
        DESCRIPTION VARCHAR2(250) NULL,
        NEXT_FIRE_TIME NUMBER(13) NULL,
        PREV_FIRE_TIME NUMBER(13) NULL,
        PRIORITY NUMBER(13) NULL,
        TRIGGER_STATE VARCHAR2(16) NOT NULL,
        TRIGGER_TYPE VARCHAR2(8) NOT NULL,
        START_TIME NUMBER(13) NOT NULL,
        END_TIME NUMBER(13) NULL,
        CALENDAR_NAME VARCHAR2(200) NULL,
        MISFIRE_INSTR NUMBER(2) NULL,
        JOB_DATA BLOB NULL,
        CONSTRAINT QRTZ_TRIGGERS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
        CONSTRAINT QRTZ_TRIGGER_TO_JOBS_FK FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) 
          REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP) 
    );
    CREATE TABLE qrtz_simple_triggers
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        REPEAT_COUNT NUMBER(7) NOT NULL,
        REPEAT_INTERVAL NUMBER(12) NOT NULL,
        TIMES_TRIGGERED NUMBER(10) NOT NULL,
        CONSTRAINT QRTZ_SIMPLE_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
        CONSTRAINT QRTZ_SIMPLE_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
        REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    );
    CREATE TABLE qrtz_cron_triggers
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        CRON_EXPRESSION VARCHAR2(120) NOT NULL,
        TIME_ZONE_ID VARCHAR2(80),
        CONSTRAINT QRTZ_CRON_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
        CONSTRAINT QRTZ_CRON_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
          REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    );
    CREATE TABLE qrtz_simprop_triggers
      (          
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        STR_PROP_1 VARCHAR2(512) NULL,
        STR_PROP_2 VARCHAR2(512) NULL,
        STR_PROP_3 VARCHAR2(512) NULL,
        INT_PROP_1 NUMBER(10) NULL,
        INT_PROP_2 NUMBER(10) NULL,
        LONG_PROP_1 NUMBER(13) NULL,
        LONG_PROP_2 NUMBER(13) NULL,
        DEC_PROP_1 NUMERIC(13,4) NULL,
        DEC_PROP_2 NUMERIC(13,4) NULL,
        BOOL_PROP_1 VARCHAR2(1) NULL,
        BOOL_PROP_2 VARCHAR2(1) NULL,
        CONSTRAINT QRTZ_SIMPROP_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
        CONSTRAINT QRTZ_SIMPROP_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
          REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    );
    CREATE TABLE qrtz_blob_triggers
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        BLOB_DATA BLOB NULL,
        CONSTRAINT QRTZ_BLOB_TRIG_PK PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
        CONSTRAINT QRTZ_BLOB_TRIG_TO_TRIG_FK FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
            REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
    );
    CREATE TABLE qrtz_calendars
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        CALENDAR_NAME  VARCHAR2(200) NOT NULL, 
        CALENDAR BLOB NOT NULL,
        CONSTRAINT QRTZ_CALENDARS_PK PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
    );
    CREATE TABLE qrtz_paused_trigger_grps
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        TRIGGER_GROUP  VARCHAR2(200) NOT NULL, 
        CONSTRAINT QRTZ_PAUSED_TRIG_GRPS_PK PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
    );
    CREATE TABLE qrtz_fired_triggers 
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        ENTRY_ID VARCHAR2(95) NOT NULL,
        TRIGGER_NAME VARCHAR2(200) NOT NULL,
        TRIGGER_GROUP VARCHAR2(200) NOT NULL,
        INSTANCE_NAME VARCHAR2(200) NOT NULL,
        FIRED_TIME NUMBER(13) NOT NULL,
        SCHED_TIME NUMBER(13) NOT NULL,
        PRIORITY NUMBER(13) NOT NULL,
        STATE VARCHAR2(16) NOT NULL,
        JOB_NAME VARCHAR2(200) NULL,
        JOB_GROUP VARCHAR2(200) NULL,
        IS_NONCONCURRENT VARCHAR2(1) NULL,
        REQUESTS_RECOVERY VARCHAR2(1) NULL,
        CONSTRAINT QRTZ_FIRED_TRIGGER_PK PRIMARY KEY (SCHED_NAME,ENTRY_ID)
    );
    CREATE TABLE qrtz_scheduler_state 
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        INSTANCE_NAME VARCHAR2(200) NOT NULL,
        LAST_CHECKIN_TIME NUMBER(13) NOT NULL,
        CHECKIN_INTERVAL NUMBER(13) NOT NULL,
        CONSTRAINT QRTZ_SCHEDULER_STATE_PK PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
    );
    CREATE TABLE qrtz_locks
      (
        SCHED_NAME VARCHAR2(120) NOT NULL,
        LOCK_NAME  VARCHAR2(40) NOT NULL, 
        CONSTRAINT QRTZ_LOCKS_PK PRIMARY KEY (SCHED_NAME,LOCK_NAME)
    );
    
    create index idx_qrtz_j_req_recovery on qrtz_job_details(SCHED_NAME,REQUESTS_RECOVERY);
    create index idx_qrtz_j_grp on qrtz_job_details(SCHED_NAME,JOB_GROUP);
    
    create index idx_qrtz_t_j on qrtz_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
    create index idx_qrtz_t_jg on qrtz_triggers(SCHED_NAME,JOB_GROUP);
    create index idx_qrtz_t_c on qrtz_triggers(SCHED_NAME,CALENDAR_NAME);
    create index idx_qrtz_t_g on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP);
    create index idx_qrtz_t_state on qrtz_triggers(SCHED_NAME,TRIGGER_STATE);
    create index idx_qrtz_t_n_state on qrtz_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE);
    create index idx_qrtz_t_n_g_state on qrtz_triggers(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE);
    create index idx_qrtz_t_next_fire_time on qrtz_triggers(SCHED_NAME,NEXT_FIRE_TIME);
    create index idx_qrtz_t_nft_st on qrtz_triggers(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME);
    create index idx_qrtz_t_nft_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME);
    create index idx_qrtz_t_nft_st_misfire on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE);
    create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);
    
    create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME);
    create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY);
    create index idx_qrtz_ft_j_g on qrtz_fired_triggers(SCHED_NAME,JOB_NAME,JOB_GROUP);
    create index idx_qrtz_ft_jg on qrtz_fired_triggers(SCHED_NAME,JOB_GROUP);
    create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP);
    create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP);

    %quartz_home%srcorgquartzquartz.properties

    # Default Properties file for use by StdSchedulerFactory
    # to create a Quartz Scheduler Instance, if a different
    # properties file is not explicitly specified.
    #
    
    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
  • 相关阅读:
    RESTful API
    访问方式由http改为https curl:(51)
    java.lang.OutOfMemoryError: PermGen space
    liunx下tomcat启动 Cannot find ./catalina.sh
    Java-编译后出现$1.class、$2.class等多个class文件
    错误处理的返回--异常还是返回值
    ubuntu 上安装温度检测
    mysql5.6不能输入中文
    jmap在ubuntu上DebuggerException: Can't attach to the process
    tomcat-reload-与内存泄露
  • 原文地址:https://www.cnblogs.com/zno2/p/4890949.html
Copyright © 2011-2022 走看看