亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? clock.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Intalio.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Intalio. Exolab is a registered
 *    trademark of Intalio.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY INTALIO AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * INTALIO OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 1999-2005 (C) Intalio Inc. All Rights Reserved.
 *
 * $Id: Clock.java,v 1.2 2005/03/25 13:22:01 tanderson Exp $
 */
package org.exolab.jms.common.uuid;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 * Provides an efficient mechanism for obtaining the current
 * system time. Uses a background thread to automatically increment
 * an internal clock and periodically synchronize with the system clock.
 * The method {@link #clock clock} is more efficient than 
 * <code>java.lang.System.currentTimeMillis</code>, and also
 * allows the clock to be artificially advanced for testing purposes.
 * <p>
 * The clock is thread-safe and consumes a single thread.
 * <p>
 * This class originally came from Tyrex: http://tyrex.sourceforge.net
 *
 * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
 * @version $Revision: 1.2 $
 */
public final class Clock extends Thread {

    /**
     * The number of clock ticks in each unsynchronized cycle.
     * The default is 100 milliseconds.
     */
    public static final int UNSYNCH_TICKS = 100;


    /**
     * The number of unsychronized cycles before the clock is
     * synchronized with the system clock. The default is 10.
     */
    public static final int SYNCH_EVERY = 10;


    /**
     * The current clock.
     */
    private static long _clock;


    /**
     * The number of clock ticks to skip before incrementing the internal
     * clock.
     */
    private static int _unsynchTicks = UNSYNCH_TICKS;

    /**
     * The number of cycles to skip before synchronizing with the system
     * clock.
     */
    private static int _synchEvery = SYNCH_EVERY;


    /**
     * The amount of time in milliseconds by which to advance the clock
     * compared to the system clock.
     */
    private static long _advance;


    /**
     * Used to adjust the clock when it gets out of synch. Based on the
     * difference between the last clock and the system clock at the point of
     * synchronization, divided by synchEvery.
     */
    private static int _adjust;

    /**
     * The logger
     */
    private static final Log _log = LogFactory.getLog(Clock.class);


    /**
     * Returns the current clock.
     *
     * @return The current clock
     */
    public static synchronized long clock() {
        // Synchronization is required since clock is a long.
        return _clock;
    }


    /**
     * Sets the number of clock ticks in each unsynchronized cycle.
     * Use zero to restore the default value.
     * <p>
     * The internal clock is advanced every cycle, the length of the
     * cycle is controlled by this property. A higher value results
     * in a lower clock resolution.
     *
     * @param ticks The number of clock ticks (milliseconds) for
     * each unsynchronized cycle
     */
    public static void setUnsynchTicks(int ticks) {
        if (ticks <= 0) {
            ticks = UNSYNCH_TICKS;
        } else if (ticks < 100) {
            ticks = 100;
        }
        _unsynchTicks = ticks;
    }


    /**
     * Returns the number of clock ticks in each unsynchronized cycle.
     *
     * @return The number of clock ticks (milliseconds) for
     * each unsynchronized cycle
     */
    public static int getUnsynchTicks() {
        return _unsynchTicks;
    }


    /**
     * Sets the number of unsynchronized cycles before the clock
     * is synchronized with the system clock.
     * <p>
     * Synchronization will occur every <tt>unsynchTicks * synchEvery</tt>
     * milliseconds. The larger the value, the less accurate
     * the clock is.
     *
     * @param every The number of unsynchronized cycles
     */
    public static void setSynchEvery(int every) {
        if (every <= 0)
            every = SYNCH_EVERY;
        _synchEvery = every;
    }


    /**
     * Artficially advances the clock.
     *
     * @param byMillis The number of milliseconds by which to
     * advance the clock (must be positive)
     */
    public synchronized static void advance(long byMillis) {
        // Synchronization is required since clock is a long.
        _advance += byMillis;
        _clock += byMillis;
    }


    /**
     * Returns the number of milliseconds by which the clock is
     * advanced.
     *
     * @return The number of milliseconds by which the clock is
     * advanced
     */
    public static long getAdvance() {
        return _advance;
    }


    public void run() {
        while (true) {
            try {
                for (int i = 0; i < _synchEvery; ++i) {
                    sleep(_unsynchTicks);
                    synchronized (Clock.class) {
                        _clock += _unsynchTicks + _adjust;
                    }
                }
                synchronize();
            } catch (InterruptedException exception) {
                // interrupted - need to resynchronize
                synchronize();
            } catch (ThreadDeath exception) {
                // allow this to be terminated when Thread.stop() is
                // invoked. This occurs when applets are destroyed.
                _log.debug("clock daemon terminating", exception);
                throw exception;
            } catch (Throwable exception) {
                _log.error("Internal error in clock daemon", exception);
            }
        }
    }


    public static synchronized long synchronize() {
        long current;
        long retarded;
        long clock;
        int adjust;

        current = System.currentTimeMillis();
        clock = _clock;
        retarded = clock - _advance;
        // Adjust clock to new difference
        if (current != retarded) {
            adjust = (int) (current - retarded) / _synchEvery;
            if (adjust != 0) {
                _adjust += adjust;
                /*
                if ( Configuration.verbose )
                    Logger.tyrex.debug( "Clock late by " + ( current - retarded ) +
                                        "ms -> synchronized, adjusting by " + _clock._adjust );
                */
            }
        }
        // Make sure clock is progressive
        if (current > retarded) {
            clock = current + _advance;
            _clock = clock;
        }
        return clock;
    }


    private Clock() {
        super("Clock Daemon");
        _clock = System.currentTimeMillis();
        setPriority(Thread.MAX_PRIORITY);
        setDaemon(true);
        start();
    }

    static {
        new Clock();
    }

    public static void main(String[] args) {
        long clock;
        int count;

        try {
            count = 1000000;
            System.out.println("Using Clock.clock()");
            clock = System.currentTimeMillis();
            for (int i = 0; i < count; ++i) {
                if ((i % 100) == 0)
                    synchronize();
                else
                    clock();
            }
            clock = System.currentTimeMillis() - clock;
            System.out.println("Performed " + count + " in " + clock + "ms");
            System.out.println("Using System.currentTimeMillis()");
            clock = System.currentTimeMillis();
            for (int i = 0; i < count; ++i)
                System.currentTimeMillis();
            clock = System.currentTimeMillis() - clock;
            System.out.println("Performed " + count + " in " + clock + "ms");
        } catch (Exception except) {
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
看电视剧不卡顿的网站| 欧美午夜精品一区| 欧美在线小视频| 国产网红主播福利一区二区| 亚洲小少妇裸体bbw| 国产iv一区二区三区| 日韩视频国产视频| 一区二区三区日韩欧美| 国产精品亚洲成人| 日韩精品中文字幕一区| 午夜精品一区二区三区免费视频 | 99re热这里只有精品免费视频| 在线播放欧美女士性生活| 亚洲欧美日韩电影| www.性欧美| 久久精品亚洲麻豆av一区二区 | 亚洲国产一区视频| 91视频www| 1024亚洲合集| 成人h动漫精品| 中文一区二区完整视频在线观看 | 亚洲18色成人| 欧美亚洲高清一区二区三区不卡| 中文无字幕一区二区三区| 国产传媒欧美日韩成人| 久久久久国产免费免费| 国产一区二区美女诱惑| 欧美sm极限捆绑bd| 六月丁香婷婷久久| 精品国产在天天线2019| 久久国产精品99久久人人澡| 精品日韩欧美一区二区| 国产综合久久久久影院| 久久久青草青青国产亚洲免观| 国产一区二区三区免费在线观看 | 91精品久久久久久蜜臀| 日本欧美一区二区在线观看| 日韩视频免费直播| 国产精品一级片在线观看| 国产午夜精品一区二区三区视频| 国产激情一区二区三区四区| 亚洲国产成人午夜在线一区 | 欧美日韩成人综合在线一区二区| 亚洲一区二区欧美| 在线综合+亚洲+欧美中文字幕| 日韩电影在线观看一区| 欧美成人一区二区三区在线观看| 激情五月播播久久久精品| 久久婷婷综合激情| 成人久久久精品乱码一区二区三区| 日本一区二区电影| 在线亚洲欧美专区二区| 日本va欧美va精品| 中文一区二区在线观看| 日本电影亚洲天堂一区| 人人狠狠综合久久亚洲| 国产欧美视频一区二区| 色婷婷久久一区二区三区麻豆| 婷婷开心激情综合| 久久婷婷国产综合精品青草| 99久久精品国产一区| 视频在线在亚洲| 国产亚洲欧美激情| 欧美专区亚洲专区| 国产原创一区二区| 亚洲国产视频直播| 久久久久国产精品厨房| 欧美日韩一级二级三级| 国产九色精品成人porny | 精品一区二区三区av| 综合网在线视频| 欧美α欧美αv大片| 9i看片成人免费高清| 免费成人在线网站| 一区二区三区免费观看| 久久久噜噜噜久噜久久综合| 欧美日韩一级黄| 99久久久久久| 国产在线看一区| 日韩精品一二三四| 亚洲免费观看高清完整| 久久综合久久鬼色| 在线不卡一区二区| 欧美亚洲高清一区二区三区不卡| 国产黄色成人av| 久久国产人妖系列| 日韩激情av在线| 一区二区三区加勒比av| 国产精品久久久爽爽爽麻豆色哟哟| 欧美人xxxx| 欧美在线你懂的| 91小视频免费观看| 高清不卡在线观看av| 久久狠狠亚洲综合| 午夜精品久久久久久久久 | 欧美极品另类videosde| 精品国偷自产国产一区| 欧美二区三区91| 欧美性一区二区| 色天天综合色天天久久| 成人毛片在线观看| 成人免费看视频| 成人理论电影网| 国产成人综合网站| 国产a级毛片一区| 国产精品一二二区| 国产成人av电影免费在线观看| 免费成人美女在线观看| 免费观看在线色综合| 人人狠狠综合久久亚洲| 视频一区欧美精品| 日本欧美久久久久免费播放网| 手机精品视频在线观看| 无吗不卡中文字幕| 美女视频网站久久| 精品中文字幕一区二区| 国产精品自拍在线| 国产91清纯白嫩初高中在线观看| 国产在线看一区| 成人综合在线观看| av在线综合网| 91蜜桃传媒精品久久久一区二区| 99久久久精品免费观看国产蜜| 91美女片黄在线观看91美女| 一本大道综合伊人精品热热 | 性欧美疯狂xxxxbbbb| 视频在线观看91| 韩国成人在线视频| 成人一区在线观看| 一本大道av一区二区在线播放| 在线亚洲人成电影网站色www| 欧美日韩一区三区四区| 91精品国产乱码| 国产午夜久久久久| 亚洲精品视频免费看| 午夜久久久久久电影| 精品在线播放免费| 成人av片在线观看| 欧美日本一道本| 国产亚洲一区二区在线观看| 综合久久综合久久| 秋霞影院一区二区| 成人av在线资源网| 欧美一区二区视频免费观看| 久久久激情视频| 亚洲国产aⅴ成人精品无吗| 免费观看在线色综合| 99精品视频中文字幕| 欧美男同性恋视频网站| 欧美极品美女视频| 天天av天天翘天天综合网| 国产在线视频一区二区三区| 91视频国产资源| 久久这里只有精品6| 一区二区三区精密机械公司| 国产一区二区在线影院| 日本丰满少妇一区二区三区| 精品国产一区二区国模嫣然| 一区二区三区中文在线观看| 国内精品伊人久久久久影院对白| 色婷婷一区二区三区四区| 精品国产一区二区精华| 亚洲高清久久久| 成人av网在线| 久久亚洲精精品中文字幕早川悠里| 亚洲免费在线电影| 国产精品888| 日韩欧美精品在线| 亚洲一区二区在线视频| 成人美女在线观看| 2021中文字幕一区亚洲| 亚洲超丰满肉感bbw| 99麻豆久久久国产精品免费优播| 日韩欧美一二区| 亚洲mv大片欧洲mv大片精品| 一本大道综合伊人精品热热| 国产三级一区二区| 久久99精品久久久| 欧美一区二区三区视频| 亚洲成人1区2区| 在线观看日韩电影| 亚洲免费在线视频一区 二区| 岛国精品在线观看| 国产欧美日韩一区二区三区在线观看| 日本美女一区二区三区| 欧美美女一区二区三区| 亚洲国产视频在线| 欧日韩精品视频| 一区二区三区在线视频免费| 99久久精品免费看国产免费软件| 国产欧美日韩综合| 国产91精品露脸国语对白| 久久久久久久久久电影| 国产乱国产乱300精品| 久久久久久久久99精品| 国产白丝精品91爽爽久久| 欧美国产激情二区三区| 成人不卡免费av| 一区精品在线播放| 91美女精品福利|