public void contextDestroyed(ServletContextEvent event) {// 在这里关闭监听器,所以在这里销毁定时器。
timer.cancel();
log.info("定时器销毁");
}
}
LEDTimeTrack
Java代码
package com.ving.xzfw.led;
import java.util.TimerTask;
public class LEDTimerTack extends TimerTask {
String fileRealPath = "";
String templePath = "";
String type="";
int floor;
public LEDTimerTack(String fileRealPath,String templePath,String type,Integer floor) {
this.fileRealPath=fileRealPath;
this.templePath=templePath;
this.type =type;
this.floor=floor;
}
public LEDTimerTack(String fileRealPath,String templePath) {
this.fileRealPath=fileRealPath;
this.templePath=templePath;
}
public void run( ) {
for(int i=1;i<=3;i++)
//呵呵,这里就是led动态生成信息的代码!
XlsUtil.createHtmlFile(templePath, fileRealPath,i);
}
}