提交 04df353b 编写于 作者: T Technoboy-

refactor getKillProcessThread method

上级 4b5f60d9
...@@ -290,22 +290,20 @@ public class WorkerServer implements IStoppable { ...@@ -290,22 +290,20 @@ public class WorkerServer implements IStoppable {
Runnable killProcessThread = new Runnable() { Runnable killProcessThread = new Runnable() {
@Override @Override
public void run() { public void run() {
Set<String> taskInfoSet = taskQueue.smembers(Constants.DOLPHINSCHEDULER_TASKS_KILL);
while (Stopper.isRunning()){ while (Stopper.isRunning()){
try { Set<String> taskInfoSet = taskQueue.smembers(Constants.DOLPHINSCHEDULER_TASKS_KILL);
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (InterruptedException e) {
logger.error("interrupted exception",e);
}
// if set is null , return
if (CollectionUtils.isNotEmpty(taskInfoSet)){ if (CollectionUtils.isNotEmpty(taskInfoSet)){
for (String taskInfo : taskInfoSet){ for (String taskInfo : taskInfoSet){
killTask(taskInfo, processDao); killTask(taskInfo, processDao);
removeKillInfoFromQueue(taskInfo); removeKillInfoFromQueue(taskInfo);
} }
} }
try {
taskInfoSet = taskQueue.smembers(Constants.DOLPHINSCHEDULER_TASKS_KILL); Thread.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (InterruptedException e) {
logger.error("interrupted exception",e);
Thread.currentThread().interrupt();
}
} }
} }
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册