cachetimer.java

来自「JSP聊天系统」· Java 代码 · 共 27 行

JAVA
27
字号
package org.ehotsoft.yekki.util.cache;

public class CacheTimer extends Thread {

    private long updateInterval;

	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) {
            Cache.currentTime = System.currentTimeMillis();
            try {
                sleep(updateInterval);
            }
            catch (InterruptedException ie) { }
        }
    }
}

⌨️ 快捷键说明

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