我是靠谱客的博主 负责煎蛋,这篇文章主要介绍触发流程的监控实例,现在分享给大家,希望可以做个参考。

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() {

//监控要做的事情,

}

最后

以上就是负责煎蛋最近收集整理的关于触发流程的监控实例的全部内容,更多相关触发流程内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(134)

评论列表共有 0 条评论

立即
投稿
返回
顶部