Browse Source

系统:系统任务和一次性任务

4.0
郑根木 2 years ago
parent
commit
f21f674a97
1 changed files with 3 additions and 6 deletions
  1. +3
    -6
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/oneTimeService/OneTimeServiceFactory.java

+ 3
- 6
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/oneTimeService/OneTimeServiceFactory.java View File

@@ -39,9 +39,6 @@ public class OneTimeServiceFactory {


private OnetimeTaskHelper taskHelper = null; private OnetimeTaskHelper taskHelper = null;


//服务器编号
private int runServer = SwConsts.SysParam.machineId;

public OneTimeServiceFactory() { public OneTimeServiceFactory() {
} }


@@ -82,7 +79,7 @@ public class OneTimeServiceFactory {
* @throws Exception * @throws Exception
*/ */
public void push(String type, String key, String name, long bizId, String inparams, UserSession us) { public void push(String type, String key, String name, long bizId, String inparams, UserSession us) {
if (taskHelper.isExistByKey(type, key)) {
if (getTasksHelper().isExistByKey(type, key)) {
throw new BizException("该任务已经存在,不能新增!"); throw new BizException("该任务已经存在,不能新增!");
} }
OnetimeTask task = new OnetimeTask(); OnetimeTask task = new OnetimeTask();
@@ -114,7 +111,7 @@ public class OneTimeServiceFactory {
* @throws Exception * @throws Exception
*/ */
public void restart(String type, String key) { public void restart(String type, String key) {
OnetimeTask task = taskHelper.findOneByTk(type, key);
OnetimeTask task = getTasksHelper().findOneByTk(type, key);
if (task != null && !task.isNew()) { if (task != null && !task.isNew()) {
schedule.schedule(new OneTimeSysService(task), 1L, TimeUnit.MILLISECONDS); schedule.schedule(new OneTimeSysService(task), 1L, TimeUnit.MILLISECONDS);
} }
@@ -125,7 +122,7 @@ public class OneTimeServiceFactory {
if (schedule != null) { if (schedule != null) {
stop(); stop();
} }
List<OnetimeTask> listService = taskHelper.findWaiting();
List<OnetimeTask> listService = getTasksHelper().findWaiting();
schedule = Executors.newScheduledThreadPool(max_thread_size); schedule = Executors.newScheduledThreadPool(max_thread_size);
for (OnetimeTask task : listService) { for (OnetimeTask task : listService) {
schedule.schedule(new OneTimeSysService(task), 10L, TimeUnit.SECONDS); schedule.schedule(new OneTimeSysService(task), 10L, TimeUnit.SECONDS);


Loading…
Cancel
Save