cachetimer.java
来自「天乙代码src_531.rar 天乙代码src_531.rar 天乙代」· Java 代码 · 共 45 行
JAVA
45 行
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 + =
减小字号Ctrl + -
显示快捷键?