spring boot + quartz 集群
spring boot bean配置:
- @Configuration
- public class QuartzConfig {
- @Value("${quartz.scheduler.instanceName}")
- private String quartzInstanceName;
- @Value("${org.quartz.dataSource.myDS.driver}")
- private String myDSDriver;
- @Value("${org.quartz.dataSource.myDS.URL}")
- private String myDSURL;
- @Value("${org.quartz.dataSource.myDS.user}")
- private String myDSUser;
- @Value("${org.quartz.dataSource.myDS.password}")
- private String myDSPassword;
- @Value("${org.quartz.dataSource.myDS.maxConnections}")
- private String myDSMaxConnections;
- /**
- * 设置属性
- * @return
- * @throws IOException
- */
- private Properties quartzProperties() throws IOException {
- Properties prop = new Properties();
- prop.put("quartz.scheduler.instanceName", quartzInstanceName);
- prop.put("org.quartz.scheduler.instanceId", "AUTO");
- prop.put("org.quartz.scheduler.skipUpdateCheck", "true");
- prop.put("org.quartz.scheduler.jmx.export", "true");
- prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
- prop.put("org.quartz.jobStore.driverDelegateClass", "org.quartz.impl.jdbcjobstore.StdJDBCDelegate");
- prop.put("org.quartz.jobStore.dataSource", "quartzDataSource");
- prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
- prop.put("org.quartz.jobStore.isClustered", "true");
- prop.put("org.quartz.jobStore.clusterCheckinInterval", "20000");
- prop.put("org.quartz.jobStore.dataSource", "myDS");
- prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
- prop.put("org.quartz.jobStore.misfireThreshold", "120000");
- prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
- prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE");
- prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
- prop.put("org.quartz.threadPool.threadCount", "10");
- prop.put("org.quartz.threadPool.threadPriority", "5");
- prop.put("org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread", "true");
- prop.put("org.quartz.dataSource.myDS.driver", myDSDriver);
- prop.put("org.quartz.dataSource.myDS.URL", myDSURL);
- prop.put("org.quartz.dataSource.myDS.user", myDSUser);
- prop.put("org.quartz.dataSource.myDS.password", myDSPassword);
- System.out.println("myDSMaxConnections:" + myDSMaxConnections);
- prop.put("org.quartz.dataSource.myDS.maxConnections", myDSMaxConnections);
- prop.put("org.quartz.plugin.triggHistory.class", "org.quartz.plugins.history.LoggingJobHistoryPlugin");
- prop.put("org.quartz.plugin.shutdownhook.class", "org.quartz.plugins.management.ShutdownHookPlugin");
- prop.put("org.quartz.plugin.shutdownhook.cleanShutdown", "true");
- return prop;
- }
- @Bean
- public SchedulerFactoryBean schedulerFactoryBean(@Qualifier("dialogJobTrigger") Trigger cronJobTrigger) throws IOException {
- SchedulerFactoryBean factory = new SchedulerFactoryBean();
- // this allows to update triggers in DB when updating settings in config file:
- //用于quartz集群,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
- factory.setOverwriteExistingJobs(true);
- //用于quartz集群,加载quartz数据源
- //factory.setDataSource(dataSource);
- //QuartzScheduler 延时启动,应用启动完10秒后 QuartzScheduler 再启动
- factory.setStartupDelay(10);
- //用于quartz集群,加载quartz数据源配置
- factory.setQuartzProperties(quartzProperties());
- factory.setAutoStartup(true);
- factory.setApplicationContextSchedulerContextKey("applicationContext");
- //注册触发器
- factory.setTriggers(cronJobTrigger);
//直接使用配置文件- // factory.setConfigLocation(new FileSystemResource(this.getClass().getResource("/quartz.properties").getPath()));
- return factory;
- }
- /**
- * 加载job
- * @return
- */
- @Bean
- public JobDetailFactoryBean updateDialogStatusJobDetail() {
- return createJobDetail(InvokingJobDetailDetailFactory.class, "updateDialogStatusGroup", "dialogJob");
- }
- /**
- * 加载触发器
- * @param jobDetail
- * @return
- */
- @Bean(name = "dialogJobTrigger")
- public CronTriggerFactoryBean dialogStatusJobTrigger(@Qualifier("updateDialogStatusJobDetail") JobDetail jobDetail) {
- return dialogStatusTrigger(jobDetail, "0 0 0/1 * * ?");
- }
- /**
- * 创建job工厂
- * @param jobClass
- * @param groupName
- * @param targetObject
- * @return
- */
- private static JobDetailFactoryBean createJobDetail(Class<?> jobClass, String groupName, String targetObject) {
- JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
- factoryBean.setJobClass(jobClass);
- factoryBean.setDurability(true);
- factoryBean.setRequestsRecovery(true);
- factoryBean.setGroup(groupName);
- Map<String, String> map = new HashMap<>();
- map.put("targetObject", targetObject);
- map.put("targetMethod", "execute");
- factoryBean.setJobDataAsMap(map);
- return factoryBean;
- }
- /**
- * 创建触发器工厂
- * @param jobDetail
- * @param cronExpression
- * @return
- */
- private static CronTriggerFactoryBean dialogStatusTrigger(JobDetail jobDetail, String cronExpression) {
- CronTriggerFactoryBean factoryBean = new CronTriggerFactoryBean();
- factoryBean.setJobDetail(jobDetail);
- factoryBean.setCronExpression (cronExpression);
- return factoryBean;
- }
- }
- InvokingJobDetailDetailFactory对象:
- public class InvokingJobDetailDetailFactory extends QuartzJobBean{
- // 计划任务所在类
- private String targetObject;
- // 具体需要执行的计划任务
- private String targetMethod;
- private ApplicationContext ctx;
- @Override
- protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
- try {
- Object otargetObject = ctx.getBean(targetObject);
- Method m = null;
- try {
- m = otargetObject.getClass().getMethod(targetMethod);
- m.invoke(otargetObject);
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- } catch (Exception e) {
- throw new JobExecutionException(e);
- }
- }
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.ctx = applicationContext;
- }
- public void setTargetObject(String targetObject) {
- this.targetObject = targetObject;
- }
- public void setTargetMethod(String targetMethod) {
- this.targetMethod = targetMethod;
- }
- }
备注:set方法不能少,setApplicationContext中的applicationContext与factory.setApplicationContextSchedulerContextKey("applicationContext")填入的值有关,其原理由InvokingJobDetailDetailFactory父类中的BeanWrapper实现。
sql脚本:--
- -- 表的结构 `qrtz_blob_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_blob_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `BLOB_DATA` blob
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_calendars`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_calendars` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `CALENDAR_NAME` varchar(120) NOT NULL,
- `CALENDAR` blob NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_cron_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_cron_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `CRON_EXPRESSION` varchar(120) NOT NULL,
- `TIME_ZONE_ID` varchar(80) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_fired_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_fired_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `ENTRY_ID` varchar(95) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `INSTANCE_NAME` varchar(120) NOT NULL,
- `FIRED_TIME` bigint(13) NOT NULL,
- `SCHED_TIME` bigint(13) NOT NULL,
- `PRIORITY` int(11) NOT NULL,
- `STATE` varchar(16) NOT NULL,
- `JOB_NAME` varchar(120) DEFAULT NULL,
- `JOB_GROUP` varchar(120) DEFAULT NULL,
- `IS_NONCONCURRENT` varchar(1) DEFAULT NULL,
- `REQUESTS_RECOVERY` varchar(1) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_job_details`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_job_details` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `JOB_NAME` varchar(120) NOT NULL,
- `JOB_GROUP` varchar(120) NOT NULL,
- `DESCRIPTION` varchar(250) DEFAULT NULL,
- `JOB_CLASS_NAME` varchar(250) NOT NULL,
- `IS_DURABLE` varchar(1) NOT NULL,
- `IS_NONCONCURRENT` varchar(1) NOT NULL,
- `IS_UPDATE_DATA` varchar(1) NOT NULL,
- `REQUESTS_RECOVERY` varchar(1) NOT NULL,
- `JOB_DATA` blob
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_locks`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_locks` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `LOCK_NAME` varchar(40) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_paused_trigger_grps`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_paused_trigger_grps` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_scheduler_state`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_scheduler_state` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `INSTANCE_NAME` varchar(120) NOT NULL,
- `LAST_CHECKIN_TIME` bigint(13) NOT NULL,
- `CHECKIN_INTERVAL` bigint(13) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_simple_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_simple_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `REPEAT_COUNT` bigint(7) NOT NULL,
- `REPEAT_INTERVAL` bigint(12) NOT NULL,
- `TIMES_TRIGGERED` bigint(10) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_simprop_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_simprop_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `STR_PROP_1` varchar(512) DEFAULT NULL,
- `STR_PROP_2` varchar(512) DEFAULT NULL,
- `STR_PROP_3` varchar(512) DEFAULT NULL,
- `INT_PROP_1` int(11) DEFAULT NULL,
- `INT_PROP_2` int(11) DEFAULT NULL,
- `LONG_PROP_1` bigint(20) DEFAULT NULL,
- `LONG_PROP_2` bigint(20) DEFAULT NULL,
- `DEC_PROP_1` decimal(13,4) DEFAULT NULL,
- `DEC_PROP_2` decimal(13,4) DEFAULT NULL,
- `BOOL_PROP_1` varchar(1) DEFAULT NULL,
- `BOOL_PROP_2` varchar(1) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- -- --------------------------------------------------------
- --
- -- 表的结构 `qrtz_triggers`
- --
- CREATE TABLE IF NOT EXISTS `qrtz_triggers` (
- `SCHED_NAME` varchar(120) NOT NULL,
- `TRIGGER_NAME` varchar(120) NOT NULL,
- `TRIGGER_GROUP` varchar(120) NOT NULL,
- `JOB_NAME` varchar(120) NOT NULL,
- `JOB_GROUP` varchar(120) NOT NULL,
- `DESCRIPTION` varchar(250) DEFAULT NULL,
- `NEXT_FIRE_TIME` bigint(13) DEFAULT NULL,
- `PREV_FIRE_TIME` bigint(13) DEFAULT NULL,
- `PRIORITY` int(11) DEFAULT NULL,
- `TRIGGER_STATE` varchar(16) NOT NULL,
- `TRIGGER_TYPE` varchar(8) NOT NULL,
- `START_TIME` bigint(13) NOT NULL,
- `END_TIME` bigint(13) DEFAULT NULL,
- `CALENDAR_NAME` varchar(200) DEFAULT NULL,
- `MISFIRE_INSTR` smallint(2) DEFAULT NULL,
- `JOB_DATA` blob
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
- --
- -- Indexes for dumped tables
- --
- --
- -- Indexes for table `qrtz_blob_triggers`
- --
- ALTER TABLE `qrtz_blob_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
- ADD KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_calendars`
- --
- ALTER TABLE `qrtz_calendars`
- ADD PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`);
- --
- -- Indexes for table `qrtz_cron_triggers`
- --
- ALTER TABLE `qrtz_cron_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_fired_triggers`
- --
- ALTER TABLE `qrtz_fired_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`),
- ADD KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`),
- ADD KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`),
- ADD KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
- ADD KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`),
- ADD KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
- ADD KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_job_details`
- --
- ALTER TABLE `qrtz_job_details`
- ADD PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
- ADD KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`),
- ADD KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`);
- --
- -- Indexes for table `qrtz_locks`
- --
- ALTER TABLE `qrtz_locks`
- ADD PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`);
- --
- -- Indexes for table `qrtz_paused_trigger_grps`
- --
- ALTER TABLE `qrtz_paused_trigger_grps`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_scheduler_state`
- --
- ALTER TABLE `qrtz_scheduler_state`
- ADD PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`);
- --
- -- Indexes for table `qrtz_simple_triggers`
- --
- ALTER TABLE `qrtz_simple_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_simprop_triggers`
- --
- ALTER TABLE `qrtz_simprop_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`);
- --
- -- Indexes for table `qrtz_triggers`
- --
- ALTER TABLE `qrtz_triggers`
- ADD PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`),
- ADD KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`),
- ADD KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`),
- ADD KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`(191)),
- ADD KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`),
- ADD KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`),
- ADD KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
- ADD KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`),
- ADD KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`),
- ADD KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`),
- ADD KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`),
- ADD KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`),
- ADD KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`);
- --
- -- 限制导出的表
- --
- --
- -- 限制表 `qrtz_blob_triggers`
- --
- ALTER TABLE `qrtz_blob_triggers`
- ADD CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`);
- --
- -- 限制表 `qrtz_cron_triggers`
- --
- ALTER TABLE `qrtz_cron_triggers`
- ADD CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`);
- --
- -- 限制表 `qrtz_simple_triggers`
- --
- ALTER TABLE `qrtz_simple_triggers`
- ADD CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`);
- --
- -- 限制表 `qrtz_simprop_triggers`
- --
- ALTER TABLE `qrtz_simprop_triggers`
- ADD CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `qrtz_triggers` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`);
- --
- -- 限制表 `qrtz_triggers`
- --
- ALTER TABLE `qrtz_triggers`
- ADD CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `qrtz_job_details` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`);
quartz集群实现原理,利用数据库记录job行为,并通过锁机制,使job在同一次中仅运行一次。
JobBean示例
- //需要交由spring管理
@Service("dialogJob")- public class DialogJob {
- @Autowired
- private QuestionService questionService;
// 方法名在quartz定义- public void execute() throws Exception{
- //具体执行业务
questionService.XXXXX();- }
- }
spring boot + quartz 集群的更多相关文章
- Spring集成quartz集群配置总结
1.spring-quartz.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE be ...
- 搭建高可用rabbitmq集群及spring boot实现集群配置
java spring boot配置: //具体参看了配置的源码 org.springframework.boot.autoconfigure.amqp.RabbitProperties //Rabb ...
- spring boot 整合 quartz 集群环境 实现 动态定时任务配置【原】
最近做了一个spring boot 整合 quartz 实现 动态定时任务配置,在集群环境下运行的 任务.能够对定时任务,动态的进行增删改查,界面效果图如下: 1. 在项目中引入jar 2. 将需要 ...
- Spring Boot Quartz 分布式集群任务调度实现
Spring Boot Quartz 主要内容 Spring Scheduler 框架 Quartz 框架,功能强大,配置灵活 Quartz 集群 mysql 持久化定时任务脚本(tables_mys ...
- (4) Spring中定时任务Quartz集群配置学习
原 来配置的Quartz是通过spring配置文件生效的,发现在非集群式的服务器上运行良好,但是将工程部署到水平集群服务器上去后改定时功能不能正常运 行,没有任何错误日志,于是从jar包.JDK版本. ...
- Spring+quartz集群配置,Spring定时任务集群,quartz定时任务集群
Spring+quartz集群配置,Spring定时任务集群,quartz定时任务集群 >>>>>>>>>>>>>> ...
- Spring+Quartz集群环境下定时调度的解决方案
集群环境可能出现的问题 在上一篇博客我们介绍了如何在自己的项目中从无到有的添加了Quartz定时调度引擎,其实就是一个Quartz 和Spring的整合过程,很容易实现,但是我们现在企业中项目通常都是 ...
- Spring+Quartz 集群
这几天给Spring+Quartz的集群折腾得死去活来,google了无数页总算搞定,记下一些要点备以后使用. 单独的Quartz集群在http://unmi.blogjava.net/有Unmi翻译 ...
- Spring+quartz集群解决多服务器部署定时器重复执行的问题
一.问题描述 Spring自带的Task虽然能很好使用定时任务,只需要做些简单的配置就可以了.不过如果部署在多台服务器上的时候,这样定时任务会在每台服务器都会执行,造成重复执行. 二.解决方案 Spr ...
随机推荐
- GDAL书籍中删除数据勘误(C#语言)
GDAL书籍中关于C#版本删除数据的时候,不能完全删除数据,由于我对C#不了解导致代码有点问题,非常感谢@Bingoyin指出并给出修改方案.此外对于栅格图像的删除.重命名,矢量数据的删除和重命名都有 ...
- 【Unity Shaders】ShadowGun系列之一——飞机坠毁的浓烟效果
写在前面 最近一直在思考下面的学习该怎么进行,当然自己有在一边做项目一边学OpenGL,偶尔翻翻论文之类的.但是,写shader是一个需要实战和动手经验的过程,而模仿是前期学习的必经之路.很多人都会问 ...
- 步步为营---- MuleEsb学习(一) 扫盲篇
本篇文章是基于不断的接触GXPT之后,对其技术开始不断的积累学习^^^,有很多问题带给我了思考,对于如何的处理各个部分的流程?这个如何处理?太多的问题促使着我一步一步的学习,在师哥们的指导下,逐步的清 ...
- TDD实践感悟
每个开发者都想开发出高质量的代码,更少的Bug.更容易维护不仅让人心情愉悦,也让我们有更多时间去学习和生活. 少加一些班,多陪家人,:) 当开发任务非常简单时,比如基本的增删改查,可能使用怎样的方式开 ...
- Scipy教程 - 优化和拟合库scipy.optimize
http://blog.csdn.net/pipisorry/article/details/51106570 最优化函数库Optimization 优化是找到最小值或等式的数值解的问题.scipy. ...
- UNIX环境高级编程——互斥量属性
互斥量具有一些属性,通过修改这些属性可以控制锁的一些行为.缺省的互斥锁属性及其值如下: pshared: PTHREAD_PROCESS_PRIVATE type: ...
- 在golang中使用leveldb
leveldb是一个很强悍的kv数据库,自然,我也希望能在go中使用. 如果有官方的go leveldb实现,那我会优先考虑,譬如这个,但是该库文档完全没有,并且在网上没发现有人用于实战环境,对其能否 ...
- Swift基础之PickerView(时间)选择器
代码讲解:(后面有额外代码讲解) 首页设计UIPickerView的样式设计: leftArray = ["花朵","颜色","形状"]; ...
- 开放源码的安卓天气应用-android学习之旅(73)
我在github上面发布了简易的天气应用,能够简单显示全国各个省市县市的天气 效果图片如下 源代码我放在github上了.我希望大家可以去下载,修改以后在上传维护,我的代码很简单.算是抛砖引玉,希望大 ...
- rhel6.4 安装 mysql-5.6
rhel6.4 安装 mysql-5.6 下载(临时地址, 如不可用,请到oracle官网下载) 采用rpm安装. mysql服务端要安装: ftp://pepstack.com/pub/rpm/My ...