Browse Source

Merge pull request #353 from lgcareer/branch-1.0.2

Determine if a node exists before deleting it
pull/2/head
lgcareer 6 years ago committed by GitHub
parent
commit
e28862d8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java

3
escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java

@ -206,7 +206,10 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue {
String taskIdPath = tasksQueuePath + nodeValue;
logger.info("consume task {}", taskIdPath);
try{
Stat stat = zk.checkExists().forPath(taskIdPath);
if(stat != null){
zk.delete().forPath(taskIdPath);
}
}catch(Exception e){
logger.error(String.format("delete task:%s from zookeeper fail, exception:" ,nodeValue) ,e);
}

Loading…
Cancel
Save