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

📄 timer.java

📁 p2p仿真器。开发者可以工作在覆盖层中进行创造和测试逻辑算法或者创建和测试新的服务。PlanetSim还可以将仿真代码平稳转换为在Internet上的实验代码
💻 JAVA
字号:
package planet.util.timer;

/**
 * This interface permits to schedule differents tasks to specified delays, and
 * to make periodic any task, begining to the specified delay and rerun after
 * <b>period</b> time.
 * <br><br>
 * Both <b>delay</b> and <b>period</b> are longs. Differents implementations
 * will use this value as steps (in simulation case) or millis (in real
 * implementation case).
 * <br><br>
 * At last, also it permits to cancel all scheduled tasks.
 * <br><br>
 * The final implementations must to have a constructor with no arguments.
 * @author Jordi Pujol
 */
public interface Timer extends java.io.Serializable {
	
	/**
	 * Sets a TimerTask to execute only once, after <b>delay</b> time.
	 * The time will be  steps in simulation world, or millis in
	 * real world.
	 * @param task TimerTask implementation with the job to do.
	 * @param delay Time after which will be invoked <b>task.run()</b>
	 */
	public void setTimerTask(TimerTask task,long delay);
	
	/**
	 * Sets a TimerTask to execute only once, after <b>delay</b> time, and
	 * after each <b>period</b> time.
	 * The time will be  steps in simulation world, or millis in
	 * real world.
	 * @param task TimerTask implementation with the job to do.
	 * @param delay Timer after which will be invoked <b>task.run()</b>
	 * @param period The period of time for waiting after first invocation
	 * (and followings) to invoke another time <b>task.run()</b>.
	 */
	public void setTimerTask(TimerTask task,long delay,long period);
	
	/**
	 * Cancels all TimerTasks active actually. 
	 */
	public void cancel();
	
}

⌨️ 快捷键说明

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