Examples of Delayed


Examples of java.util.concurrent.Delayed

     * This may occur if a task is eligible to be dequeued, but has
     * not yet been, while some other task is added with a delay of
     * Long.MAX_VALUE.
     */
    private long overflowFree(long delay) {
        Delayed head = workQueue.peek();
        if (head != null) {
            long headDelay = head.getDelay(NANOSECONDS);
            if (headDelay < 0 && (delay - headDelay < 0))
                delay = Long.MAX_VALUE + headDelay;
        }
        return delay;
    }
View Full Code Here

Examples of java.util.concurrent.Delayed

        currentNodes = nodes;// 切换引用,需设置为volatile保证线程安全&可见性
        // 处理下dead node
        if (deadNodes.size() > 0) {
            for (Long nid : deadNodes) {
                Delayed delayed = new DeadNodeDelayed(nid, checkTime);
                if (!queue.contains(delayed)) {// 不重复添加
                    queue.add(new DeadNodeDelayed(nid, checkTime));
                }
            }
        }
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.