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

📄 timerplugin.java

📁 SSH示范
💻 JAVA
字号:
package com.iplan.portal.framework.web;

import java.util.Timer;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;

/**
 * 定时器PlugIn
 * <p>
 * http://www.hao-se.cn
 * </p>
 * 
 * @author ws
 */
public class TimerPlugin implements PlugIn {
	private final Timer timer = new Timer();

	private String millisecond = "1000";

	public TimerPlugin() {
	}

	public void destroy() {
		this.timer.cancel();
	}

	public void init(ActionServlet parm1, ModuleConfig parm2)
			throws ServletException {
		ServletContext context = parm1.getServletContext();
		BackUpDBUtil.setServletContext(context);
		context.setAttribute("millisecond", millisecond);

		this.timer.schedule(new ImportMask(), 0, Integer
				.parseInt(this.millisecond) * 60 * 60 * 2);
	}

	public void setMillisecond(String millisecond) {
		this.millisecond = millisecond;
	}

	public String getMillisecond() {
		return this.millisecond;
	}
}

⌨️ 快捷键说明

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