timerservice.java

来自「采用JAVA开发」· Java 代码 · 共 29 行

JAVA
29
字号
/*
 * Created on 2004-8-6
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.gctech.misc.other.time;

import java.util.Timer;

public class TimerService {
	public static final long p = 1000 * 60 * 60;
	Timer timer = new Timer(false);
	TimerSchedule schedule = null;

	public TimerService() {
	}

	public void start() throws Exception {
		schedule = new TimerSchedule();
		schedule.addTimerJob(new TimerJobSub());
		//add other job here       
		timer.schedule(schedule, 0, p);
	}

	public void stop() throws Exception {
		timer.cancel();
	}
}

⌨️ 快捷键说明

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