Questo codice è da testare! … non usare per cose serie
public static void main(String args[]) throws Exception { Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); String[] gnames = scheduler.getJobGroupNames(); for (String curr_group : gnames){ String [] jobnames = scheduler.getJobNames(curr_group); for (String job: jobnames){ System.out.println(" job " +job + " gruppo " +curr_group+ ""); } String[] triggernames = scheduler.getTriggerNames(curr_group); for (String trigger : triggernames){ System.out.println(" job " +trigger + " gruppo " +curr_group ); } } }
public static void main(String[] args) throws SchedulerException { String jobname = ""; String groupname = Scheduler.DEFAULT_GROUP; Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler(); if (args.length == 0) { ammazzatutto(scheduler); } if (args.length >0 ) { jobname = args[0]; if (args.length >1) { groupname = args[1]; } ammazzajob(scheduler,jobname,groupname); } } private static void ammazzajob(Scheduler scheduler, String jobname, String groupname) throws SchedulerException { scheduler.deleteJob(jobname, groupname); } private static void ammazzatutto(Scheduler scheduler) throws SchedulerException { String[] gnames = scheduler.getJobGroupNames(); for (int i = 0 ; i < gnames.length ; i++){ String curr_group = gnames[i]; System.out.println(curr_group); String [] jobnames = scheduler.getJobNames(curr_group); for (String job : jobnames){ System.out.println(" uccido job " +job + " gruppo " +curr_group+ ""); ammazzajob(scheduler, job, curr_group); } } }