概述
public class AutoRunFlowListener implements ServletContextListener{
private static final Logger log = Logger.getLogger(AutoRunFlowListener.class);
private Timer timer = null;
private RunFlowTask task = null;
public void contextDestroyed(ServletContextEvent servletContextEvent) {
if(timer != null){
timer.cancel();
}
log.info("自动触发流程定时器销毁");
servletContextEvent.getServletContext().log("自动触发流程定时器销毁");
}
public void contextInitialized(ServletContextEvent servletContextEvent) {
PropertiesParser prop = new PropertiesParser();
String provinceId = prop.getProperty("provinceId");
if(!"114".equals(provinceId)){
return;
}
timer = new Timer(true);
task = new RunFlowTask();
log.info("自动触发流程定时器启动");
servletContextEvent.getServletContext().log("定时器已启动");
timer.schedule(task, 0, 180000); //三分钟加载一次
log.info("自动触发流程已经添加任务调度表");
}
}
class RunFlowTask extends TimerTask{
private static final Logger log = Logger.getLogger(RunFlowTask.class);
public RunFlowTask(){}
@Override
public void run() {
//监控要做的事情,
}
最后
以上就是负责煎蛋为你收集整理的触发流程的监控实例的全部内容,希望文章能够帮你解决触发流程的监控实例所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复