|
|
@@ -39,9 +39,6 @@ public class OneTimeServiceFactory { |
|
|
|
|
|
|
|
private OnetimeTaskHelper taskHelper = null; |
|
|
|
|
|
|
|
//服务器编号 |
|
|
|
private int runServer = SwConsts.SysParam.machineId; |
|
|
|
|
|
|
|
public OneTimeServiceFactory() { |
|
|
|
} |
|
|
|
|
|
|
@@ -82,7 +79,7 @@ public class OneTimeServiceFactory { |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
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("该任务已经存在,不能新增!"); |
|
|
|
} |
|
|
|
OnetimeTask task = new OnetimeTask(); |
|
|
@@ -114,7 +111,7 @@ public class OneTimeServiceFactory { |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
public void restart(String type, String key) { |
|
|
|
OnetimeTask task = taskHelper.findOneByTk(type, key); |
|
|
|
OnetimeTask task = getTasksHelper().findOneByTk(type, key); |
|
|
|
if (task != null && !task.isNew()) { |
|
|
|
schedule.schedule(new OneTimeSysService(task), 1L, TimeUnit.MILLISECONDS); |
|
|
|
} |
|
|
@@ -125,7 +122,7 @@ public class OneTimeServiceFactory { |
|
|
|
if (schedule != null) { |
|
|
|
stop(); |
|
|
|
} |
|
|
|
List<OnetimeTask> listService = taskHelper.findWaiting(); |
|
|
|
List<OnetimeTask> listService = getTasksHelper().findWaiting(); |
|
|
|
schedule = Executors.newScheduledThreadPool(max_thread_size); |
|
|
|
for (OnetimeTask task : listService) { |
|
|
|
schedule.schedule(new OneTimeSysService(task), 10L, TimeUnit.SECONDS); |
|
|
|