java - How to query the scheduled jobs from Quartz scheduler? -


i have scheduler object in application , add jobs using schedulejob method.

in code schedule jobs instant trigger:

triggerbuilder.newtrigger().startnow().build(); 

my question how tell jobs scheduled scheduler? there getcurrentlyexecutingjobs method seems unreliable far.

the below code list quartz job associated scheduler (quartz 2.x.x)

for (string groupname : scheduler.getjobgroupnames()) {   (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);    }  } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -