All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.holmos.cache.systemtask.HolmosAbstractTask Maven / Gradle / Ivy

The newest version!
package com.holmos.cache.systemtask;

import java.util.TimerTask;

public abstract class HolmosAbstractTask extends TimerTask{
	
	/**指示当前任务是否在执行*/
	private volatile boolean runnable=false;
	
	/**
	 * 继续执行
	 * */
	public void goon(){
		this.runnable=true;
	}
	
	/**
	 * 暂停执行
	 * */
	public void pause(){
		this.runnable=false;
	}
	
	@Override
	public void run(){
		if(this.runnable){
			this.doRun();
		}
	}
	
	/**
	 * 定时任务执行方法体
	 * */
	protected abstract void doRun();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy