Quartz Scheduler Administration Page: Information about misfired triggers

邮差的信 提交于 2019-12-25 09:05:09

问题


We have a Java application (ESB) that uses quartz 2.2.1 and we use it to schedule hundreds of user jobs.

I want to build monitoring page (or scheduler administration page) in my application for our users so that they can see if quartz scheduler is running fine or there is any issue in this component.

Does quartz provides any monitoring API for this purpose? Can anyone please tell us what all data points should we show in this monitoring (or administration) page based on your experience? Some of the points that I can think of:

  1. Scheduler Status (Running | Paused | Shutdown).
  2. Number of jobs running with "Previous Fire Time" and "Next FireTime" information.
  3. Thread pool implementation and its size.
  4. JDBCJobStore configuration details.

Is there a way to show the information about triggers that were misfired? I don't see any API that provides me information about misfired triggers. Can anyone tell me how to get this information from scheduler?

Any help in this regard shall be appreciated.


回答1:


You named here many different issues

Scheduler Status(1) :

Scheduler sched =...
sched.isInStandbyMode();
sched.isStarted();
sched.isShutdown();

Number of jobs running with...(2) see here

Scheduler scheduler = new StdSchedulerFactory().getScheduler();

   for (String groupName : scheduler.getJobGroupNames()) {

     for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {

      String jobName = jobKey.getName();
      String jobGroup = jobKey.getGroup();

      //get job's trigger
      List<Trigger> triggers = (List<Trigger>) scheduler.getTriggersOfJob(jobKey);
      Date nextFireTime = triggers.get(0).getNextFireTime(); 

        System.out.println("[jobName] : " + jobName + " [groupName] : "
            + jobGroup + " - " + nextFireTime);

      }

    }

Thread pool implementation and its size.(3)

Scheduler sched =...
sched.getMetaData().getThreadPoolClass()
sched.getMetaData().getThreadPoolSize()

Regarding "triggers that were misfired", you can use listeners, specifically TriggerListener.html#triggerMisfired may be helpful for you.



来源:https://stackoverflow.com/questions/37690199/quartz-scheduler-administration-page-information-about-misfired-triggers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!