Browse Source

Determine if a node exists before deleting it

pull/2/head
ligang 6 years ago
parent
commit
8a4fe1d86e
  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