⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cachetimer.java

📁 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar 天乙代码src_531.rar
💻 JAVA
字号:
package com.laoer.bbscs.util;

/**
 * <p>Title: 天乙社区V5.0</p>
 * <p>Description: BBS-CS天乙社区V5.0</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: laoer.com</p>
 * @author 龚天乙
 * @version 5.0
 */

public class CacheTimer
    extends Thread {

  private static long updateInterval;
  public static long currentTime;

  //Statically start a timing thread with 1 second of accuracy.
  static {
    new CacheTimer(1000);
  }

  public CacheTimer(long updateInterval) {
    this.updateInterval = updateInterval;
    //Make the timer be a daemon thread so that it won't keep the VM from
    //shutting down if there are no other threads.
    this.setDaemon(true);
    //Start the timer thread.
    start();
  }

  public void run() {
    //Run the timer indefinetly.
    while (true) {
      currentTime = System.currentTimeMillis();
      Cache.currentTime = currentTime;
      //LongCache.currentTime = currentTime;
      try {
        sleep(updateInterval);
      }
      catch (InterruptedException ie) {}
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -