Giter Club home page Giter Club logo

spring-quartz-cluster-sample's Introduction

Quartz将Job保存在数据库中所需表的说明 http://www.cnblogs.com/Rozdy/p/4269762.html

public static String rtp(String query, String tablePrefix, String schedNameLiteral) {  
    return MessageFormat.format(query, new Object[]{tablePrefix, schedNameLiteral});  
}  

StdSchedulerFactory.java
instanceId 这么生成的。

if (schedInstId.equals(AUTO_GENERATE_INSTANCE_ID)) {
autoId = true;
instanceIdGeneratorClass = cfg.getStringProperty(
PROP_SCHED_INSTANCE_ID_GENERATOR_CLASS,
"org.quartz.simpl.SimpleInstanceIdGenerator");
}

public class SimpleInstanceIdGenerator implements InstanceIdGenerator {
public String generateInstanceId() throws SchedulerException {
try {
//最好部署在不同服务器上
return InetAddress.getLocalHost().getHostName() + System.currentTimeMillis();
} catch (Exception e) {
throw new SchedulerException("Couldn't get host name!", e);
}
}
}

实例化在 StdJDBCDelegate.java initialize() 方法里

spring-quartz-cluster-sample

Spring整合Quartz基于数据库的分布式定时任务,可动态添加、删除、修改定时任务。

创建quartz数据库

执行src/main/resources/scripts下的建表语句

执行src/main/resources/create-schema.sql语句

修改数据库连接信息

Screenshots

spring-quartz-cluster-sample's People

Contributors

tanliwei avatar v5tech avatar

Stargazers

ZengTester avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.