Pārlūkot izejas kodu

系统:定时任务

4.0
郑根木 pirms 2 gadiem
vecāks
revīzija
713d022078
3 mainītis faili ar 18 papildinājumiem un 0 dzēšanām
  1. +3
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/BpmStartedListener.java
  2. +14
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/job/TestJob.java
  3. +1
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/systask/SingleRequestHelper.java

+ 3
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/BpmStartedListener.java Parādīt failu

@@ -9,6 +9,7 @@ import cc.smtweb.framework.core.mvc.controller.IStartListener;
import cc.smtweb.framework.core.mvc.service.TreeHelper;
import cc.smtweb.framework.core.systask.SysServiceFactory;
import cc.smtweb.system.bpm.web.design.db.ModelCatalogTreeHelper;
import cc.smtweb.system.bpm.web.sys.base.job.JobUtils;
import cc.smtweb.system.bpm.web.sys.oneTimeService.OneTimeServiceFactory;
import cc.smtweb.system.bpm.web.sys.oneTimeService.OneTimeTaskCleanService;

@@ -36,10 +37,12 @@ public class BpmStartedListener implements IStartListener {
//初始化缓存
CacheManager.getIntance().init();
OneTimeServiceFactory.getInstance().start();
JobUtils.getInstance().start();
}

@Override
public void close() {
OneTimeServiceFactory.getInstance().stop();
JobUtils.getInstance().stop();
}
}

+ 14
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/job/TestJob.java Parādīt failu

@@ -0,0 +1,14 @@
package cc.smtweb.system.bpm.web.sys.base.job;

import cc.smtweb.framework.core.util.DateUtil;

/**
* Created by Akmm at 2022-09-14 10:32
*/
public class TestJob extends BaseJob {
@Override
protected String work() {
System.out.println("执行了" + DateUtil.nowDateTimeString());
return "哈哈,成功了";
}
}

+ 1
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/systask/SingleRequestHelper.java Parādīt failu

@@ -5,6 +5,7 @@ import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.framework.core.util.StringUtil;

//redis控制的互斥执行,一般用于定时任务,避免多服务器重复执行
public class SingleRequestHelper {

public static interface ISingleWork {


Notiek ielāde…
Atcelt
Saglabāt