Package com.alibaba.otter.shared.arbitrate.impl.zookeeper.lock

Examples of com.alibaba.otter.shared.arbitrate.impl.zookeeper.lock.DistributedLock.tryLock()


    protected NormalTerminProcess    normalTerminProcess;

    public boolean process(TerminEventData data) {
        DistributedLock lock = new DistributedLock(StagePathUtils.getLoadLock(data.getPipelineId()));
        try {
            boolean locked = lock.tryLock();// 尝试进行锁定,等待当前的load操作完成
            if (!locked) {
                return false;
            }
            processChain(data);
            return true;
View Full Code Here


            nodes[i] = node;
            exeucotr.submit(new Runnable() {

                public void run() {
                    try {
                        while (node.tryLock() == false) {
                            Thread.sleep(100 + RandomUtils.nextInt(100));
                        }

                        System.out.println("id: " + node.getId() + " is leader: " + node.isOwner());
                    } catch (InterruptedException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.