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

📄 threadtimertask.java

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

/**
 * This concrete implementation extends the java.util.TimerTask and adapt
 * this implementation to use the superclass. It is required to implement
 * TimerTask to use with ThreadTimer. 
 * 
 * @author <a href="mailto: jordi.pujol@estudiants.urv.es">Jordi Pujol</a>
 * Date: 07/05/2004
 * @see planet.util.timer.ThreadTimer ThreadTimer
 */
public abstract class ThreadTimerTask extends java.util.TimerTask implements TimerTask {
	private boolean finished = false;
	
	/**
	 * Initialize this TimerTask. 
	 */
	public ThreadTimerTask() {
		super();
	}

	/**
	 * Cancels this TimerTask. If this task is in execution
	 * it normally finish.
	 * @see planet.util.timer.TimerTask#cancel()
	 * @return true if it avoid almost one execution of this task.
	 */
	public boolean cancel() {
		finished = true;
		return super.cancel();
	}
	
	/**
	 * Implements this method to make the concrete necessary job. 
	 * @see planet.util.timer.TimerTask#run()
	 */
	public abstract void run();
	
	/**
	 * Inform if this TimerTask has been cancelled.
	 * @see planet.util.timer.TimerTask#isFinished()
	 * @return true if this TimerTask has been cancelled.
	 */
	public boolean isFinished() {
		return finished;
	}
}

⌨️ 快捷键说明

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