Browse Source

Merge pull request #606 from LgbDemo/dev

double check 变量需要volatile修饰
pull/2/head
easyscheduler 6 years ago committed by GitHub
parent
commit
bb00a6d206
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      escheduler-common/src/main/java/cn/escheduler/common/queue/TaskQueueZkImpl.java

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

@ -17,20 +17,26 @@
package cn.escheduler.common.queue; package cn.escheduler.common.queue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import cn.escheduler.common.Constants; import cn.escheduler.common.Constants;
import cn.escheduler.common.utils.Bytes; import cn.escheduler.common.utils.Bytes;
import cn.escheduler.common.utils.IpUtils; import cn.escheduler.common.utils.IpUtils;
import cn.escheduler.common.utils.OSUtils; import cn.escheduler.common.utils.OSUtils;
import cn.escheduler.common.zk.AbstractZKClient; import cn.escheduler.common.zk.AbstractZKClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.*;
/** /**
* A singleton of a task queue implemented with zookeeper * A singleton of a task queue implemented with zookeeper
* tasks queue implemention * tasks queue implemention
@ -39,7 +45,7 @@ public class TaskQueueZkImpl extends AbstractZKClient implements ITaskQueue {
private static final Logger logger = LoggerFactory.getLogger(TaskQueueZkImpl.class); private static final Logger logger = LoggerFactory.getLogger(TaskQueueZkImpl.class);
private static TaskQueueZkImpl instance; private static volatile TaskQueueZkImpl instance;
private TaskQueueZkImpl(){ private TaskQueueZkImpl(){
init(); init();

Loading…
Cancel
Save