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

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

?? timer.java

?? Jive論壇2.5版本的源程序
?? JAVA
字號:
/**
 * $RCSfile: Timer.java,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:51:16 $
 *
 * Copyright (C) 1999-2001 CoolServlets Inc. All rights reserved.
 * ===================================================================
 * The Jive Software License (based on Apache Software License, Version 1.1)
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 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 end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Jive Software (http://www.jivesoftware.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.
 *
 * THIS SOFTWARE IS PROVIDED ``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 COOLSERVLETS INC 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.
 * ====================================================================
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Jive Software. For more information
 * on Jive Software please visit http://www.jivesoftware.com.
 */

package com.jivesoftware.util;

import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.util.Date;

/**
 * A simple replacement for the java.util.Timer class in JDK 1.3.
 * <P>
 * Functionally this class performs similarly to the java.util.Timer
 * class in JDK 1.3 although it probably is not as robust. The main
 * difference is that it uses a simple List for its task queue that
 * it traverses linearly, so it may not scale as well as the 1.3
 * version.
 * <P>
 * Refer to the JDK 1.3 documentation for a full description of how
 * this works.
 *
 * @author	Joseph Mocker
 */
public class Timer {

   private TimerEngine timer = null;
   protected List tasks = null;
   private Object lock = new Object();

   /**
    * Create a new Timer.
    */
   public Timer() {
      this(false);
   }

   /**
    * Create a new Timer. Additionally specify if the underlying
    * timer thread is a daemon thread or not.
    *
    * @param isDaemon true if timer thread should run as a daemon.
    */
   public Timer(boolean isDaemon) {
      tasks = new ArrayList();

      timer = new TimerEngine();
      timer.setDaemon(isDaemon);

      timer.start();
   }

   /**
    * Schedule a single-execution task after a delay.
    *
    * @param task task to be scheduled.
    * @param delay delay in milliseconds before task is to be executed.
    */
   public void schedule(TimerTask task, long delay) {
      schedule(task, System.currentTimeMillis() + delay, 0);
   }

   /**
    * Schedule a single-execution task at a specific time.
    *
    * @param task task to be scheduled.
    * @param time time task is to be executed.
    */
   public void schedule(TimerTask task, Date time) {
      schedule(task, time.getTime() - System.currentTimeMillis(), 0);
   }

   /**
    * Schedule a fixed-delay task beginning at a specific time.
    *
    * @param task task to be scheduled.
    * @param firstTime time the task is to be first executed.
    * @param period time in milliseconds betweek successive task executions.
    */
   public void schedule(TimerTask task, Date firstTime, long period) {
      schedule(task, firstTime.getTime() - System.currentTimeMillis(), period);
   }

    /**
     * Schedule a fixed-delay task after a delay.
     *
     * @param task task to be scheduled.
     * @param delay delay in milliseconds before task is to be executed.
     * @param period time in milliseconds betweek successive task executions.
     */
    public void schedule(TimerTask task, long delay, long period) {
        // Don't allow anything to be scheduled if someone cancelled us
        if (timer.isCancelled()) {
	    throw new IllegalStateException();
        }
        // Try to schedule the task, it will throw an exception
        // if we aren't allowed to.
        task.schedule(delay, period, true);
        synchronized(lock) {
            tasks.add(task);
        }
        timer.wakeUp();
   }

   /**
    * Schedule a fixed-rate task beginning at a specific time.
    *
    * @param task task to be scheduled.
    * @param firstTime time the task is to be first executed.
    * @param period time in milliseconds betweek successive task executions.
    */
    public void scheduleAtFixedRate(TimerTask task, Date firstTime, long period) {
        scheduleAtFixedRate(task, firstTime.getTime()-System.currentTimeMillis(),
                period);
    }

   /**
    * Schedule a fixed-rate task after a delay.
    *
    * @param task task to be scheduled.
    * @param delay delay in milliseconds before task is to be executed.
    * @param period time in milliseconds betweek successive task executions.
    */
    public void scheduleAtFixedRate(TimerTask task, long delay, long period) {
        // Don't allow anything to be scheduled if someone cancelled us
        if (timer.isCancelled()) {
            throw new IllegalStateException();
        }
        // Try to schedule the task. It will throw an exception if we
        // aren't allowed to.
        task.schedule(delay, period, false);
        synchronized(lock) {
            tasks.add(task);
        }
        timer.wakeUp();
    }

   /**
    * Terminates this timer.
    */
   public void cancel() {
      timer.cancel();
   }


   /**
    * Execution and Scheduling engine for the Timer object.
    * <P>
    * This class performs the scheduling and execution of all the
    * TimerTasks that have been added to the parent Timer object.
    *
    * @author	Joseph Mocker
    */
    protected class TimerEngine extends Thread {
        private boolean cancelled = false;

        public void run() {
            while(!cancelled) {
                // Iterate through the scheduled tasks, executing the
                // tasks which are ready to run, and find the
                // non-runnable task that should be executed next
                TimerTask current = null;
                synchronized(lock) {
                    for (Iterator i = tasks.iterator(); i.hasNext(); ) {
                        TimerTask task = (TimerTask)i.next();

                        // If the scheduledTime is 0 or it has been cancelled,
                        // just ignore this task.
                        if (task.scheduledExecutionTime() == 0 || task.isCancelled()) {
                            // Remove the task from the queue.
                            i.remove();
                            continue;
                        }

                        // If the scheduledTime is in the past, execute the task
                        // and calculate the next scheduledTime.
                        if (task.scheduledExecutionTime() <= System.currentTimeMillis())
                        {
                            task.run();
                            task.reschedule();
                            if (task.scheduledExecutionTime() == 0) {
                                continue;
                            }
                        }

                        // Decide if this task might be the next one to execute.
                        // the task with the earliest scheduledTime is the next
                        // one to execute.
                        if (current == null) {
                            current = task;
                        }
                        else if (task.scheduledExecutionTime() <
                                current.scheduledExecutionTime())
                        {
                            current = task;
                        }
                    }
                }

                // We ran through the pending tasks, so now we'll just
                // wait either until we should execute the next task
                // or some external event notifies us. If there are no runnable
                // tasks, just wait forever until we're notified.
                synchronized (this) {
                    try {
                        if (current != null) {
                            long timeout = current.scheduledExecutionTime() -
                                System.currentTimeMillis();

                            if (timeout > 0) {
                                wait(timeout);
                            }
                        }
                        else {
                            // Nothing to do, wait forever.
                            wait();
                        }
                    }
                    catch (InterruptedException e) { /* ignore */ }
                }
            }
        }

        protected synchronized void wakeUp() {
            notifyAll();
        }

        protected synchronized void cancel() {
            cancelled = true;
            wakeUp();
        }

        protected synchronized boolean isCancelled() {
            return cancelled;
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区日韩二区| 久久香蕉国产线看观看99| 亚洲猫色日本管| 91在线视频免费91| 亚洲乱码日产精品bd| 欧美撒尿777hd撒尿| 石原莉奈在线亚洲二区| 精品日韩一区二区三区| 国产乱一区二区| 亚洲欧洲精品一区二区三区 | 亚洲午夜激情网站| 欧美蜜桃一区二区三区| 久久9热精品视频| 中文字幕av一区二区三区| 色一情一乱一乱一91av| 日韩成人dvd| 久久精品无码一区二区三区| 91在线观看地址| 日韩精品每日更新| 久久久91精品国产一区二区三区| www.在线欧美| 日本视频免费一区| 国产精品剧情在线亚洲| 欧美日韩电影一区| 国产成人自拍在线| 亚洲午夜精品久久久久久久久| 精品三级av在线| 91国偷自产一区二区开放时间| 日本不卡在线视频| 国产精品超碰97尤物18| 这里只有精品99re| youjizz国产精品| 麻豆91精品91久久久的内涵| 中文字幕一区二区5566日韩| 欧美一区日韩一区| 99视频精品免费视频| 日韩经典中文字幕一区| 国产精品久久久久久久久免费相片| 在线不卡中文字幕播放| 成人精品电影在线观看| 日韩精品一区第一页| 亚洲天堂成人在线观看| 精品国产精品一区二区夜夜嗨| 色综合天天综合网国产成人综合天| 久久99精品久久久久久久久久久久| 亚洲精品国产无天堂网2021| 国产欧美综合在线| 日韩写真欧美这视频| 欧美在线高清视频| 波多野结衣精品在线| 国产美女精品人人做人人爽 | 91精品国产综合久久久久| 99免费精品视频| 国产在线视频不卡二| 日本人妖一区二区| 亚洲电影视频在线| 亚洲欧美区自拍先锋| 国产网站一区二区| 精品国产乱码久久久久久老虎| 欧美日韩午夜精品| 在线日韩一区二区| 91香蕉视频黄| 一本一道久久a久久精品 | 欧美日韩在线三级| 色一情一乱一乱一91av| av一区二区三区在线| 国产乱码精品1区2区3区| 久久av中文字幕片| 人人狠狠综合久久亚洲| 日韩福利电影在线| 日韩电影在线观看一区| 亚洲成人综合网站| 亚洲国产一区二区三区青草影视| 一区二区三区在线免费| 亚洲婷婷综合色高清在线| 国产精品国产精品国产专区不蜜| 国产日韩v精品一区二区| 久久综合九色综合97婷婷| 欧美变态tickle挠乳网站| 日韩欧美一区二区久久婷婷| 欧美成人一区二区三区片免费| 日韩欧美一区电影| 久久久久国产精品厨房| 26uuu国产一区二区三区| 久久久久久久久久久久久女国产乱| 久久综合色婷婷| 国产偷国产偷亚洲高清人白洁| 久久精品夜夜夜夜久久| 国产精品视频麻豆| 亚洲日本在线观看| 亚洲国产aⅴ天堂久久| 五月天一区二区三区| 麻豆一区二区三| 国产iv一区二区三区| 99r国产精品| 欧美精品第1页| 欧美va日韩va| 国产精品久久午夜夜伦鲁鲁| 亚洲一区免费观看| 麻豆精品视频在线观看视频| 国产精品一二一区| 色悠悠亚洲一区二区| 欧美日韩精品高清| 久久久久久一级片| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 欧美视频在线播放| 欧美videossexotv100| 中文字幕欧美国产| 亚洲精品国产一区二区精华液| 午夜影视日本亚洲欧洲精品| 黑人巨大精品欧美一区| www.亚洲精品| 欧美一区二区福利在线| 国产精品久久久久一区二区三区共 | 日韩美女在线视频| 国产精品高清亚洲| 奇米综合一区二区三区精品视频| 国产91精品一区二区麻豆亚洲| 91黄视频在线观看| 精品国产乱码久久久久久蜜臀| 亚洲美女偷拍久久| 国产伦精品一区二区三区在线观看| 91在线国产福利| 精品国产伦一区二区三区观看体验 | 极品美女销魂一区二区三区| 一本大道久久a久久精二百 | 欧美高清视频不卡网| 久久蜜桃av一区二区天堂 | jiyouzz国产精品久久| 51精品秘密在线观看| 国产精品欧美经典| 免费av网站大全久久| 91久久精品日日躁夜夜躁欧美| 国产亚洲1区2区3区| 日韩电影免费一区| 91久久精品午夜一区二区| 国产偷国产偷精品高清尤物| 麻豆免费看一区二区三区| 91精品办公室少妇高潮对白| 国产视频一区在线播放| 青青草97国产精品免费观看| 在线视频国产一区| 专区另类欧美日韩| 国产传媒一区在线| 日韩亚洲欧美综合| 丝袜诱惑制服诱惑色一区在线观看 | 久久久久久久电影| 奇米四色…亚洲| 欧美日韩高清影院| 亚洲成人三级小说| 欧美在线999| 亚洲自拍偷拍九九九| 99精品国产一区二区三区不卡| 久久九九99视频| 国产一区二区三区| 精品精品国产高清一毛片一天堂| 午夜久久久久久久久| 91黄色免费观看| 亚洲一区在线免费观看| 色综合久久综合网欧美综合网| 中文一区二区完整视频在线观看| 精品写真视频在线观看 | 久久精品视频一区| 国产九色精品成人porny| 精品久久久久久久人人人人传媒| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美猛男gaygay网站| 亚洲成人动漫在线免费观看| 欧美色综合天天久久综合精品| 亚洲精品高清在线| 欧美性猛交xxxx乱大交退制版 | 婷婷开心激情综合| 欧美日产在线观看| 青娱乐精品视频| 久久蜜臀中文字幕| 不卡一区中文字幕| 亚洲精品ww久久久久久p站| 在线区一区二视频| 日本怡春院一区二区| 精品日韩欧美在线| 国产一区二区三区最好精华液| 国产亚洲欧美一区在线观看| 成人av电影在线| 亚洲精品视频自拍| 欧美一区二区三区喷汁尤物| 国产一区高清在线| 国产精品免费久久久久| 欧美性猛交xxxxxxxx| 蜜桃一区二区三区在线观看| 久久久久久日产精品| av爱爱亚洲一区| 亚洲成人免费视频| 日韩美一区二区三区| 成人国产精品免费| 亚洲成在人线免费| 国产亚洲一区二区三区四区| 91浏览器在线视频| 美女精品一区二区| 自拍偷拍国产精品| 日韩欧美国产精品|