Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*      */ package org.quartz.core;
   /*      */ 
   /*      */ import java.io.IOException;
   /*      */ import java.io.InputStream;
   /*      */ import java.rmi.NotBoundException;
   /*      */ import java.rmi.RemoteException;
   /*      */ import java.rmi.registry.LocateRegistry;
   /*      */ import java.rmi.registry.Registry;
   /*      */ import java.rmi.server.UnicastRemoteObject;
  /*      */ import java.util.ArrayList;
  /*      */ import java.util.Collections;
  /*      */ import java.util.Date;
  /*      */ import java.util.HashMap;
  /*      */ import java.util.Iterator;
  /*      */ import java.util.LinkedList;
  /*      */ import java.util.List;
  /*      */ import java.util.Properties;
  /*      */ import java.util.Random;
  /*      */ import java.util.Set;
  /*      */ import org.apache.commons.logging.Log;
  /*      */ import org.apache.commons.logging.LogFactory;
  /*      */ import org.quartz.Calendar;
  /*      */ import org.quartz.InterruptableJob;
  /*      */ import org.quartz.Job;
  /*      */ import org.quartz.JobDataMap;
  /*      */ import org.quartz.JobDetail;
  /*      */ import org.quartz.JobExecutionContext;
  /*      */ import org.quartz.JobExecutionException;
  /*      */ import org.quartz.JobListener;
  /*      */ import org.quartz.JobPersistenceException;
  /*      */ import org.quartz.ObjectAlreadyExistsException;
  /*      */ import org.quartz.SchedulerContext;
  /*      */ import org.quartz.SchedulerException;
  /*      */ import org.quartz.SchedulerListener;
  /*      */ import org.quartz.SimpleTrigger;
  /*      */ import org.quartz.Trigger;
  /*      */ import org.quartz.TriggerListener;
  /*      */ import org.quartz.UnableToInterruptJobException;
  /*      */ import org.quartz.impl.SchedulerRepository;
  /*      */ import org.quartz.simpl.SimpleJobFactory;
  /*      */ import org.quartz.spi.JobFactory;
  /*      */ import org.quartz.spi.JobStore;
  /*      */ import org.quartz.spi.SchedulerPlugin;
  /*      */ import org.quartz.spi.SchedulerSignaler;
  /*      */ import org.quartz.spi.ThreadPool;
  /*      */ 
  /*      */ public class QuartzScheduler
  /*      */   implements RemotableQuartzScheduler
  /*      */ {
  /*   89 */   private static String VERSION_MAJOR = "UNKNOWN";
  /*   90 */   private static String VERSION_MINOR = "UNKNOWN";
  /*   91 */   private static String VERSION_ITERATION = "UNKNOWN";
  /*      */   private QuartzSchedulerResources resources;
  /*      */   private QuartzSchedulerThread schedThread;
  /*      */   private ThreadGroup threadGroup;
  /*  124 */   private SchedulerContext context = new SchedulerContext();
  /*      */ 
  /*  126 */   private HashMap jobListeners = new HashMap(10);
  /*      */ 
  /*  128 */   private ArrayList globalJobListeners = new ArrayList(10);
  /*      */ 
  /*  130 */   private HashMap triggerListeners = new HashMap(10);
  /*      */ 
  /*  132 */   private ArrayList globalTriggerListeners = new ArrayList(10);
  /*      */ 
  /*  134 */   private ArrayList schedulerListeners = new ArrayList(10);
  /*      */ 
  /*  136 */   private ArrayList schedulerPlugins = new ArrayList(10);
  /*      */ 
  /*  138 */   private JobFactory jobFactory = new SimpleJobFactory();
  /*      */ 
  /*  140 */   ExecutingJobsManager jobMgr = null;
  /*      */ 
  /*  142 */   ErrorLogger errLogger = null;
  /*      */   private SchedulerSignaler signaler;
  /*  146 */   private Random random = new Random();
  /*      */ 
  /*  148 */   private ArrayList holdToPreventGC = new ArrayList(5);
  /*      */ 
  /*  150 */   private boolean signalOnSchedulingChange = true;
  /*      */ 
  /*  152 */   private boolean closed = false;
  /*      */ 
  /*  154 */   private Date initialStart = null;
  /*      */ 
  /*      */   public QuartzScheduler(QuartzSchedulerResources resourcesSchedulingContext ctxtlong idleWaitTimelong dbRetryInterval)
  /*      */     throws SchedulerException
  /*      */   {
  /*  175 */     this. = resources;
  /*      */     try {
  /*  177 */       bind();
  /*      */     } catch (Exception re) {
  /*  179 */       throw new SchedulerException("Unable to bind scheduler to RMI Registry."re);
  /*      */     }
  /*      */ 
  /*  183 */     this. = new QuartzSchedulerThread(thisresourcesctxt);
  /*  184 */     if (idleWaitTime > 0L) this..setIdleWaitTime(idleWaitTime);
  /*  185 */     if (dbRetryInterval > 0L) {
  /*  186 */       this..setDbFailureRetryInterval(dbRetryInterval);
 /*      */     }
 /*  188 */     this. = new ExecutingJobsManager();
 /*  189 */     addGlobalJobListener(this.);
 /*  190 */     this. = new ErrorLogger();
 /*  191 */     addSchedulerListener(this.);
 /*      */ 
 /*  193 */     this. = new SchedulerSignalerImpl(this);
 /*      */ 
 /*  195 */     getLog().info("Quartz Scheduler v." + getVersion() + " created.");
 /*      */   }
 /*      */ 
 /*      */   public String getVersion()
 /*      */   {
 /*  207 */     return getVersionMajor() + "." + getVersionMinor() + "." + getVersionIteration();
 /*      */   }
 /*      */ 
 /*      */   public static String getVersionMajor()
 /*      */   {
 /*  212 */     return ;
 /*      */   }
 /*      */ 
 /*      */   public static String getVersionMinor() {
 /*  216 */     return ;
 /*      */   }
 /*      */ 
 /*      */   public static String getVersionIteration() {
 /*  220 */     return ;
 /*      */   }
 /*      */ 
 /*      */   public SchedulerSignaler getSchedulerSignaler() {
 /*  224 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public static Log getLog() {
 /*  228 */     return LogFactory.getLog(QuartzScheduler.class);
 /*      */   }
 /*      */ 
 /*      */   private void bind()
 /*      */     throws RemoteException
 /*      */   {
 /*  237 */     String host = this..getRMIRegistryHost();
 /*      */ 
 /*  239 */     if ((host == null) || (host.length() == 0)) return;
 /*      */ 
 /*  241 */     RemotableQuartzScheduler exportable = null;
 /*      */ 
 /*  243 */     if (this..getRMIServerPort() > 0) {
 /*  244 */       exportable = (RemotableQuartzScheduler)UnicastRemoteObject.exportObject(thisthis..getRMIServerPort());
 /*      */     }
 /*      */     else {
 /*  247 */       exportable = (RemotableQuartzScheduler)UnicastRemoteObject.exportObject(this);
 /*      */     }
 /*      */ 
 /*  250 */     Registry registry = null;
 /*      */ 
 /*  252 */     if (this..getRMICreateRegistryStrategy().equals("as_needed"))
 /*      */     {
 /*      */       try
 /*      */       {
 /*  260 */         registry = LocateRegistry.getRegistry(this..getRMIRegistryPort());
 /*      */ 
 /*  262 */         registry.list();
 /*      */       } catch (Exception e) {
 /*  264 */         registry = LocateRegistry.createRegistry(this..getRMIRegistryPort());
 /*      */       }
 /*      */     }
 /*  267 */     else if (this..getRMICreateRegistryStrategy().equals("always")) {
 /*      */       try
 /*      */       {
 /*  270 */         registry = LocateRegistry.createRegistry(this..getRMIRegistryPort());
 /*      */       }
 /*      */       catch (Exception e)
 /*      */       {
 /*  278 */         registry = LocateRegistry.getRegistry(this..getRMIRegistryPort());
 /*      */       }
 /*      */     }
 /*      */     else {
 /*  282 */       registry = LocateRegistry.getRegistry(this..getRMIRegistryHost(), this..getRMIRegistryPort());
 /*      */     }
 /*      */ 
 /*  286 */     registry.rebind(this..getUniqueIdentifier(), exportable);
 /*      */ 
 /*  288 */     getLog().info("Scheduler bound to RMI registry.");
 /*      */   }
 /*      */ 
 /*      */   private void unBind()
 /*      */     throws RemoteException
 /*      */   {
 /*  297 */     String host = this..getRMIRegistryHost();
 /*      */ 
 /*  299 */     if ((host == null) || (host.length() == 0)) return;
 /*      */ 
 /*  301 */     Registry registry = LocateRegistry.getRegistry(this..getRMIRegistryHost(), this..getRMIRegistryPort());
 /*      */     try
 /*      */     {
 /*  305 */       registry.unbind(this..getUniqueIdentifier());
 /*  306 */       UnicastRemoteObject.unexportObject(thistrue);
 /*      */     }
 /*      */     catch (NotBoundException nbe) {
 /*      */     }
 /*  310 */     getLog().info("Scheduler un-bound from RMI registry.");
 /*      */   }
 /*      */ 
 /*      */   public String getSchedulerName()
 /*      */   {
 /*  319 */     return this..getName();
 /*      */   }
 /*      */ 
 /*      */   public String getSchedulerInstanceId()
 /*      */   {
 /*  328 */     return this..getInstanceId();
 /*      */   }
 /*      */ 
 /*      */   public ThreadGroup getSchedulerThreadGroup()
 /*      */   {
 /*  337 */     if (this. == null) {
 /*  338 */       this. = new ThreadGroup("QuartzScheduler:" + getSchedulerName());
 /*      */     }
 /*      */ 
 /*  342 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public void addNoGCObject(Object obj) {
 /*  346 */     this..add(obj);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeNoGCObject(Object obj) {
 /*  350 */     return this..remove(obj);
 /*      */   }
 /*      */ 
 /*      */   public SchedulerContext getSchedulerContext()
 /*      */     throws SchedulerException
 /*      */   {
 /*  359 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public boolean isSignalOnSchedulingChange() {
 /*  363 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public void setSignalOnSchedulingChange(boolean signalOnSchedulingChange) {
 /*  367 */     this. = signalOnSchedulingChange;
 /*      */   }
 /*      */ 
 /*      */   public void start()
 /*      */     throws SchedulerException
 /*      */   {
 /*  388 */     if (this.) {
 /*  389 */       throw new SchedulerException("The Scheduler cannot be restarted after shutdown() has been called.");
 /*      */     }
 /*      */ 
 /*  392 */     this..togglePause(false);
 /*      */ 
 /*  394 */     if (this. == null) {
 /*  395 */       this. = new Date();
 /*  396 */       this..getJobStore().schedulerStarted();
 /*  397 */       startPlugins();
 /*      */     }
 /*      */ 
 /*  400 */     getLog().info("Scheduler " + this..getUniqueIdentifier() + " started.");
 /*      */   }
 /*      */ 
 /*      */   public void standby()
 /*      */   {
 /*  414 */     this..togglePause(true);
 /*  415 */     getLog().info("Scheduler " + this..getUniqueIdentifier() + " paused.");
 /*      */   }
 /*      */ 
 /*      */   public boolean isInStandbyMode()
 /*      */   {
 /*  425 */     return this..isPaused();
 /*      */   }
 /*      */ 
 /*      */   public Date runningSince() {
 /*  429 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public int numJobsExecuted() {
 /*  433 */     return this..getNumJobsFired();
 /*      */   }
 /*      */ 
 /*      */   public Class getJobStoreClass() {
 /*  437 */     return this..getJobStore().getClass();
 /*      */   }
 /*      */ 
 /*      */   public boolean supportsPersistence() {
 /*  441 */     return this..getJobStore().supportsPersistence();
 /*      */   }
 /*      */ 
 /*      */   public Class getThreadPoolClass() {
 /*  445 */     return this..getThreadPool().getClass();
 /*      */   }
 /*      */ 
 /*      */   public int getThreadPoolSize() {
 /*  449 */     return this..getThreadPool().getPoolSize();
 /*      */   }
 /*      */ 
 /*      */   public void shutdown()
 /*      */   {
 /*  464 */     shutdown(false);
 /*      */   }
 /*      */ 
 /*      */   public void shutdown(boolean waitForJobsToComplete)
 /*      */   {
 /*  483 */     if (this. == true) {
 /*  484 */       return;
 /*      */     }
 /*  486 */     getLog().info("Scheduler " + this..getUniqueIdentifier() + " shutting down.");
 /*      */ 
 /*  489 */     standby();
 /*      */ 
 /*  491 */     this. = true;
 /*      */ 
 /*  493 */     this..halt();
 /*      */ 
 /*  495 */     this..getThreadPool().shutdown(waitForJobsToComplete);
 /*      */ 
 /*  497 */     if (waitForJobsToComplete)
 /*  498 */       while (this..getNumJobsCurrentlyExecuting() > 0)
 /*      */         try {
 /*  500 */           Thread.sleep(100L);
 /*      */         }
 /*      */         catch (Exception ignore)
 /*      */         {
 /*      */         }
 /*  505 */     this..getJobStore().shutdown();
 /*      */ 
 /*  507 */     notifySchedulerListenersShutdown();
 /*      */ 
 /*  509 */     shutdownPlugins();
 /*      */ 
 /*  511 */     SchedulerRepository.getInstance().remove(this..getName());
 /*      */ 
 /*  513 */     this..clear();
 /*      */     try
 /*      */     {
 /*  516 */       unBind();
 /*      */     }
 /*      */     catch (RemoteException re) {
 /*      */     }
 /*  520 */     getLog().info("Scheduler " + this..getUniqueIdentifier() + " shutdown complete.");
 /*      */   }
 /*      */ 
 /*      */   public boolean isShutdown()
 /*      */   {
 /*  531 */     return this.;
 /*      */   }
 /*      */ 
 /*      */   public void validateState() throws SchedulerException {
 /*  535 */     if (isShutdown())
 /*  536 */       throw new SchedulerException("The Scheduler has been shutdown.");
 /*      */   }
 /*      */ 
 /*      */   public List getCurrentlyExecutingJobs()
 /*      */   {
 /*  553 */     return this..getExecutingJobs();
 /*      */   }
 /*      */ 
 /*      */   public Date scheduleJob(SchedulingContext ctxtJobDetail jobDetailTrigger trigger)
 /*      */     throws SchedulerException
 /*      */   {
 /*  580 */     validateState();
 /*      */ 
 /*  582 */     jobDetail.validate();
 /*      */ 
 /*  584 */     if (trigger.getJobName() == null) {
 /*  585 */       trigger.setJobName(jobDetail.getName());
 /*  586 */       trigger.setJobGroup(jobDetail.getGroup()); } else {
 /*  587 */       if ((trigger.getJobName() != null) && (!trigger.getJobName().equals(jobDetail.getName())))
 /*      */       {
 /*  589 */         throw new SchedulerException("Trigger does not reference given job!", 100);
 /*      */       }
 /*      */ 
 /*  592 */       if ((trigger.getJobGroup() != null) && (!trigger.getJobGroup().equals(jobDetail.getGroup())))
 /*      */       {
 /*  594 */         throw new SchedulerException("Trigger does not reference given job!", 100);
 /*      */       }
 /*      */ 
 /*      */     }
 /*      */ 
 /*  599 */     trigger.validate();
 /*      */ 
 /*  601 */     Calendar cal = null;
 /*  602 */     if (trigger.getCalendarName() != null) {
 /*  603 */       cal = this..getJobStore().retrieveCalendar(ctxttrigger.getCalendarName());
 /*      */     }
 /*      */ 
 /*  606 */     Date ft = trigger.computeFirstFireTime(cal);
 /*      */ 
 /*  608 */     if (ft == null) {
 /*  609 */       throw new SchedulerException("Based on configured schedule, the given trigger will never fire.", 100);
 /*      */     }
 /*      */ 
 /*  613 */     this..getJobStore().storeJobAndTrigger(ctxtjobDetailtrigger);
 /*  614 */     notifySchedulerThread();
 /*  615 */     notifySchedulerListenersSchduled(trigger);
 /*      */ 
 /*  617 */     return ft;
 /*      */   }
 /*      */ 
 /*      */   public Date scheduleJob(SchedulingContext ctxtTrigger trigger)
 /*      */     throws SchedulerException
 /*      */   {
 /*  633 */     validateState();
 /*      */ 
 /*  635 */     trigger.validate();
 /*      */ 
 /*  637 */     Calendar cal = null;
 /*  638 */     if (trigger.getCalendarName() != null) {
 /*  639 */       cal = this..getJobStore().retrieveCalendar(ctxttrigger.getCalendarName());
 /*      */ 
 /*  641 */       if (cal == null) {
 /*  642 */         throw new SchedulerException("Calendar not found: " + trigger.getCalendarName(), 420);
 /*      */       }
 /*      */     }
 /*      */ 
 /*  646 */     Date ft = trigger.computeFirstFireTime(cal);
 /*      */ 
 /*  648 */     if (ft == null) {
 /*  649 */       throw new SchedulerException("Based on configured schedule, the given trigger will never fire.", 100);
 /*      */     }
 /*      */ 
 /*  653 */     this..getJobStore().storeTrigger(ctxttriggerfalse);
 /*  654 */     notifySchedulerThread();
 /*  655 */     notifySchedulerListenersSchduled(trigger);
 /*      */ 
 /*  657 */     return ft;
 /*      */   }
 /*      */ 
 /*      */   public void addJob(SchedulingContext ctxtJobDetail jobDetailboolean replace)
 /*      */     throws SchedulerException
 /*      */   {
 /*  680 */     validateState();
 /*      */ 
 /*  682 */     if ((!jobDetail.isDurable()) && (!replace)) {
 /*  683 */       throw new SchedulerException("Jobs added with no trigger must be durable.", 100);
 /*      */     }
 /*      */ 
 /*  687 */     this..getJobStore().storeJob(ctxtjobDetailreplace);
 /*      */   }
 /*      */ 
 /*      */   public boolean deleteJob(SchedulingContext ctxtString jobNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  702 */     validateState();
 /*      */ 
 /*  704 */     if (groupName == null) {
 /*  705 */       groupName = "DEFAULT";
 /*      */     }
 /*  707 */     return this..getJobStore().removeJob(ctxtjobNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public boolean unscheduleJob(SchedulingContext ctxtString triggerNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  718 */     validateState();
 /*      */ 
 /*  720 */     if (groupName == null) {
 /*  721 */       groupName = "DEFAULT";
 /*      */     }
 /*  723 */     if (this..getJobStore().removeTrigger(ctxttriggerNamegroupName)) {
 /*  724 */       notifySchedulerThread();
 /*  725 */       notifySchedulerListenersUnschduled(triggerNamegroupName);
 /*      */     } else {
 /*  727 */       return false;
 /*      */     }
 /*  729 */     return true;
 /*      */   }
 /*      */ 
 /*      */   public Date rescheduleJob(SchedulingContext ctxtString triggerNameString groupNameTrigger newTrigger)
 /*      */     throws SchedulerException
 /*      */   {
 /*  752 */     validateState();
 /*      */ 
 /*  754 */     if (groupName == null) {
 /*  755 */       groupName = "DEFAULT";
 /*      */     }
 /*  757 */     newTrigger.validate();
 /*      */ 
 /*  759 */     Calendar cal = null;
 /*  760 */     if (newTrigger.getCalendarName() != null) {
 /*  761 */       cal = this..getJobStore().retrieveCalendar(ctxtnewTrigger.getCalendarName());
 /*      */     }
 /*      */ 
 /*  764 */     Date ft = newTrigger.computeFirstFireTime(cal);
 /*      */ 
 /*  766 */     if (ft == null) {
 /*  767 */       throw new SchedulerException("Based on configured schedule, the given trigger will never fire.", 100);
 /*      */     }
 /*      */ 
 /*  771 */     if (this..getJobStore().replaceTrigger(ctxttriggerNamegroupNamenewTrigger)) {
 /*  772 */       notifySchedulerThread();
 /*  773 */       notifySchedulerListenersUnschduled(triggerNamegroupName);
 /*  774 */       notifySchedulerListenersSchduled(newTrigger);
 /*      */     } else {
 /*  776 */       return null;
 /*      */     }
 /*  778 */     return ft;
 /*      */   }
 /*      */ 
 /*      */   private String newTriggerId()
 /*      */   {
 /*  784 */     long r = this..nextLong();
 /*  785 */     if (r < 0L) r = -r;
 /*  786 */     return "MT_" + Long.toString(r, 30 + (int)(System.currentTimeMillis() % 7L));
 /*      */   }
 /*      */ 
 /*      */   public void triggerJob(SchedulingContext ctxtString jobNameString groupNameJobDataMap data)
 /*      */     throws SchedulerException
 /*      */   {
 /*  798 */     validateState();
 /*      */ 
 /*  800 */     if (groupName == null) {
 /*  801 */       groupName = "DEFAULT";
 /*      */     }
 /*  803 */     Trigger trig = new SimpleTrigger(newTriggerId(), "MANUAL_TRIGGER"jobNamegroupNamenew Date(), null, 0, 0L);
 /*      */ 
 /*  806 */     trig.setVolatility(false);
 /*  807 */     trig.computeFirstFireTime(null);
 /*  808 */     if (data != null) {
 /*  809 */       trig.setJobDataMap(data);
 /*      */     }
 /*  811 */     boolean collision = true;
 /*  812 */     while (collision) {
 /*      */       try {
 /*  814 */         this..getJobStore().storeTrigger(ctxttrigfalse);
 /*  815 */         collision = false;
 /*      */       } catch (ObjectAlreadyExistsException oaee) {
 /*  817 */         trig.setName(newTriggerId());
 /*      */       }
 /*      */     }
 /*      */ 
 /*  821 */     notifySchedulerThread();
 /*  822 */     notifySchedulerListenersSchduled(trig);
 /*      */   }
 /*      */ 
 /*      */   public void triggerJobWithVolatileTrigger(SchedulingContext ctxtString jobNameString groupNameJobDataMap data)
 /*      */     throws SchedulerException
 /*      */   {
 /*  833 */     validateState();
 /*      */ 
 /*  835 */     if (groupName == null) {
 /*  836 */       groupName = "DEFAULT";
 /*      */     }
 /*  838 */     Trigger trig = new SimpleTrigger(newTriggerId(), "MANUAL_TRIGGER"jobNamegroupNamenew Date(), null, 0, 0L);
 /*      */ 
 /*  841 */     trig.setVolatility(true);
 /*  842 */     trig.computeFirstFireTime(null);
 /*  843 */     if (data != null) {
 /*  844 */       trig.setJobDataMap(data);
 /*      */     }
 /*  846 */     boolean collision = true;
 /*  847 */     while (collision) {
 /*      */       try {
 /*  849 */         this..getJobStore().storeTrigger(ctxttrigfalse);
 /*  850 */         collision = false;
 /*      */       } catch (ObjectAlreadyExistsException oaee) {
 /*  852 */         trig.setName(newTriggerId());
 /*      */       }
 /*      */     }
 /*      */ 
 /*  856 */     notifySchedulerThread();
 /*  857 */     notifySchedulerListenersSchduled(trig);
 /*      */   }
 /*      */ 
 /*      */   public void pauseTrigger(SchedulingContext ctxtString triggerNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  868 */     validateState();
 /*      */ 
 /*  870 */     if (groupName == null) {
 /*  871 */       groupName = "DEFAULT";
 /*      */     }
 /*  873 */     this..getJobStore().pauseTrigger(ctxttriggerNamegroupName);
 /*  874 */     notifySchedulerThread();
 /*  875 */     notifySchedulerListenersPausedTrigger(triggerNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public void pauseTriggerGroup(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  886 */     validateState();
 /*      */ 
 /*  888 */     if (groupName == null) {
 /*  889 */       groupName = "DEFAULT";
 /*      */     }
 /*  891 */     this..getJobStore().pauseTriggerGroup(ctxtgroupName);
 /*  892 */     notifySchedulerThread();
 /*  893 */     notifySchedulerListenersPausedTrigger(nullgroupName);
 /*      */   }
 /*      */ 
 /*      */   public void pauseJob(SchedulingContext ctxtString jobNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  905 */     validateState();
 /*      */ 
 /*  907 */     if (groupName == null) {
 /*  908 */       groupName = "DEFAULT";
 /*      */     }
 /*  910 */     this..getJobStore().pauseJob(ctxtjobNamegroupName);
 /*  911 */     notifySchedulerThread();
 /*  912 */     notifySchedulerListenersPausedJob(jobNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public void pauseJobGroup(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  924 */     validateState();
 /*      */ 
 /*  926 */     if (groupName == null) {
 /*  927 */       groupName = "DEFAULT";
 /*      */     }
 /*  929 */     this..getJobStore().pauseJobGroup(ctxtgroupName);
 /*  930 */     notifySchedulerThread();
 /*  931 */     notifySchedulerListenersPausedJob(nullgroupName);
 /*      */   }
 /*      */ 
 /*      */   public void resumeTrigger(SchedulingContext ctxtString triggerNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  948 */     validateState();
 /*      */ 
 /*  950 */     if (groupName == null) {
 /*  951 */       groupName = "DEFAULT";
 /*      */     }
 /*  953 */     this..getJobStore().resumeTrigger(ctxttriggerNamegroupName);
 /*  954 */     notifySchedulerThread();
 /*  955 */     notifySchedulerListenersResumedTrigger(triggerNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public void resumeTriggerGroup(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /*  972 */     validateState();
 /*      */ 
 /*  974 */     if (groupName == null) {
 /*  975 */       groupName = "DEFAULT";
 /*      */     }
 /*  977 */     this..getJobStore().resumeTriggerGroup(ctxtgroupName);
 /*  978 */     notifySchedulerThread();
 /*  979 */     notifySchedulerListenersResumedTrigger(nullgroupName);
 /*      */   }
 /*      */ 
 /*      */   public Set getPausedTriggerGroups(SchedulingContext ctxtthrows SchedulerException {
 /*  983 */     return this..getJobStore().getPausedTriggerGroups(ctxt);
 /*      */   }
 /*      */ 
 /*      */   public void resumeJob(SchedulingContext ctxtString jobNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1001 */     validateState();
 /*      */ 
 /* 1003 */     if (groupName == null) {
 /* 1004 */       groupName = "DEFAULT";
 /*      */     }
 /* 1006 */     this..getJobStore().resumeJob(ctxtjobNamegroupName);
 /* 1007 */     notifySchedulerThread();
 /* 1008 */     notifySchedulerListenersResumedJob(jobNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public void resumeJobGroup(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1026 */     validateState();
 /*      */ 
 /* 1028 */     if (groupName == null) {
 /* 1029 */       groupName = "DEFAULT";
 /*      */     }
 /* 1031 */     this..getJobStore().resumeJobGroup(ctxtgroupName);
 /* 1032 */     notifySchedulerThread();
 /* 1033 */     notifySchedulerListenersResumedJob(nullgroupName);
 /*      */   }
 /*      */ 
 /*      */   public void pauseAll(SchedulingContext ctxt)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1052 */     validateState();
 /*      */ 
 /* 1054 */     this..getJobStore().pauseAll(ctxt);
 /* 1055 */     notifySchedulerThread();
 /* 1056 */     notifySchedulerListenersPausedTrigger(nullnull);
 /*      */   }
 /*      */ 
 /*      */   public void resumeAll(SchedulingContext ctxt)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1073 */     validateState();
 /*      */ 
 /* 1075 */     this..getJobStore().resumeAll(ctxt);
 /* 1076 */     notifySchedulerThread();
 /* 1077 */     notifySchedulerListenersResumedTrigger(nullnull);
 /*      */   }
 /*      */ 
 /*      */   public String[] getJobGroupNames(SchedulingContext ctxt)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1087 */     validateState();
 /*      */ 
 /* 1089 */     return this..getJobStore().getJobGroupNames(ctxt);
 /*      */   }
 /*      */ 
 /*      */   public String[] getJobNames(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1100 */     validateState();
 /*      */ 
 /* 1102 */     if (groupName == null) {
 /* 1103 */       groupName = "DEFAULT";
 /*      */     }
 /* 1105 */     return this..getJobStore().getJobNames(ctxtgroupName);
 /*      */   }
 /*      */ 
 /*      */   public Trigger[] getTriggersOfJob(SchedulingContext ctxtString jobNameString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1116 */     validateState();
 /*      */ 
 /* 1118 */     if (groupName == null) {
 /* 1119 */       groupName = "DEFAULT";
 /*      */     }
 /* 1121 */     return this..getJobStore().getTriggersForJob(ctxtjobNamegroupName);
 /*      */   }
 /*      */ 
 /*      */   public String[] getTriggerGroupNames(SchedulingContext ctxt)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1133 */     validateState();
 /*      */ 
 /* 1135 */     return this..getJobStore().getTriggerGroupNames(ctxt);
 /*      */   }
 /*      */ 
 /*      */   public String[] getTriggerNames(SchedulingContext ctxtString groupName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1146 */     validateState();
 /*      */ 
 /* 1148 */     if (groupName == null) {
 /* 1149 */       groupName = "DEFAULT";
 /*      */     }
 /* 1151 */     return this..getJobStore().getTriggerNames(ctxtgroupName);
 /*      */   }
 /*      */ 
 /*      */   public JobDetail getJobDetail(SchedulingContext ctxtString jobNameString jobGroup)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1162 */     validateState();
 /*      */ 
 /* 1164 */     if (jobGroup == null) {
 /* 1165 */       jobGroup = "DEFAULT";
 /*      */     }
 /* 1167 */     return this..getJobStore().retrieveJob(ctxtjobNamejobGroup);
 /*      */   }
 /*      */ 
 /*      */   public Trigger getTrigger(SchedulingContext ctxtString triggerNameString triggerGroup)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1178 */     validateState();
 /*      */ 
 /* 1180 */     if (triggerGroup == null) {
 /* 1181 */       triggerGroup = "DEFAULT";
 /*      */     }
 /* 1183 */     return this..getJobStore().retrieveTrigger(ctxttriggerNametriggerGroup);
 /*      */   }
 /*      */ 
 /*      */   public int getTriggerState(SchedulingContext ctxtString triggerNameString triggerGroup)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1199 */     validateState();
 /*      */ 
 /* 1201 */     if (triggerGroup == null) {
 /* 1202 */       triggerGroup = "DEFAULT";
 /*      */     }
 /* 1204 */     return this..getJobStore().getTriggerState(ctxttriggerNametriggerGroup);
 /*      */   }
 /*      */ 
 /*      */   public void addCalendar(SchedulingContext ctxtString calNameCalendar calendarboolean replaceboolean updateTriggers)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1220 */     validateState();
 /*      */ 
 /* 1222 */     this..getJobStore().storeCalendar(ctxtcalNamecalendarreplaceupdateTriggers);
 /*      */   }
 /*      */ 
 /*      */   public boolean deleteCalendar(SchedulingContext ctxtString calName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1236 */     validateState();
 /*      */ 
 /* 1238 */     return this..getJobStore().removeCalendar(ctxtcalName);
 /*      */   }
 /*      */ 
 /*      */   public Calendar getCalendar(SchedulingContext ctxtString calName)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1248 */     validateState();
 /*      */ 
 /* 1250 */     return this..getJobStore().retrieveCalendar(ctxtcalName);
 /*      */   }
 /*      */ 
 /*      */   public String[] getCalendarNames(SchedulingContext ctxt)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1260 */     validateState();
 /*      */ 
 /* 1262 */     return this..getJobStore().getCalendarNames(ctxt);
 /*      */   }
 /*      */ 
 /*      */   public void addGlobalJobListener(JobListener jobListener)
 /*      */   {
 /* 1277 */     if ((jobListener.getName() == null) || (jobListener.getName().length() == 0))
 /*      */     {
 /* 1279 */       throw new IllegalArgumentException("JobListener name cannot be empty.");
 /*      */     }
 /*      */ 
 /* 1282 */     this..add(jobListener);
 /*      */   }
 /*      */ 
 /*      */   public void addJobListener(JobListener jobListener)
 /*      */   {
 /* 1291 */     if ((jobListener.getName() == null) || (jobListener.getName().length() == 0))
 /*      */     {
 /* 1293 */       throw new IllegalArgumentException("JobListener name cannot be empty.");
 /*      */     }
 /*      */ 
 /* 1296 */     this..put(jobListener.getName(), jobListener);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeGlobalJobListener(JobListener jobListener)
 /*      */   {
 /* 1309 */     return this..remove(jobListener);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeJobListener(String name)
 /*      */   {
 /* 1322 */     Object o = this..remove(name);
 /*      */ 
 /* 1324 */     return o != null;
 /*      */   }
 /*      */ 
 /*      */   public List getGlobalJobListeners()
 /*      */   {
 /* 1336 */     return new LinkedList(this.);
 /*      */   }
 /*      */ 
 /*      */   public Set getJobListenerNames()
 /*      */   {
 /* 1346 */     return Collections.unmodifiableSet(this..keySet());
 /*      */   }
 /*      */ 
 /*      */   public JobListener getJobListener(String name)
 /*      */   {
 /* 1356 */     return (JobListener)this..get(name);
 /*      */   }
 /*      */ 
 /*      */   public void addGlobalTriggerListener(TriggerListener triggerListener)
 /*      */   {
 /* 1371 */     if ((triggerListener.getName() == null) || (triggerListener.getName().length() == 0))
 /*      */     {
 /* 1373 */       throw new IllegalArgumentException("TriggerListener name cannot be empty.");
 /*      */     }
 /*      */ 
 /* 1376 */     this..add(triggerListener);
 /*      */   }
 /*      */ 
 /*      */   public void addTriggerListener(TriggerListener triggerListener)
 /*      */   {
 /* 1385 */     if ((triggerListener.getName() == null) || (triggerListener.getName().length() == 0))
 /*      */     {
 /* 1387 */       throw new IllegalArgumentException("TriggerListener name cannot be empty.");
 /*      */     }
 /*      */ 
 /* 1390 */     this..put(triggerListener.getName(), triggerListener);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeGlobalTriggerListener(TriggerListener triggerListener)
 /*      */   {
 /* 1403 */     return this..remove(triggerListener);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeTriggerListener(String name)
 /*      */   {
 /* 1416 */     Object o = this..remove(name);
 /*      */ 
 /* 1418 */     return o != null;
 /*      */   }
 /*      */ 
 /*      */   public List getGlobalTriggerListeners()
 /*      */   {
 /* 1430 */     return new LinkedList(this.);
 /*      */   }
 /*      */ 
 /*      */   public Set getTriggerListenerNames()
 /*      */   {
 /* 1440 */     return Collections.unmodifiableSet(this..keySet());
 /*      */   }
 /*      */ 
 /*      */   public TriggerListener getTriggerListener(String name)
 /*      */   {
 /* 1450 */     return (TriggerListener)this..get(name);
 /*      */   }
 /*      */ 
 /*      */   public void addSchedulerListener(SchedulerListener schedulerListener)
 /*      */   {
 /* 1460 */     this..add(schedulerListener);
 /*      */   }
 /*      */ 
 /*      */   public boolean removeSchedulerListener(SchedulerListener schedulerListener)
 /*      */   {
 /* 1473 */     return this..remove(schedulerListener);
 /*      */   }
 /*      */ 
 /*      */   public List getSchedulerListeners()
 /*      */   {
 /* 1483 */     return (List)this..clone();
 /*      */   }
 /*      */ 
 /*      */   protected void notifyJobStoreJobComplete(SchedulingContext ctxtTrigger triggerJobDetail detailint instCode)
 /*      */     throws JobPersistenceException
 /*      */   {
 /* 1490 */     this..getJobStore().triggeredJobComplete(ctxttriggerdetailinstCode);
 /*      */   }
 /*      */ 
 /*      */   protected void notifySchedulerThread()
 /*      */   {
 /* 1495 */     if (isSignalOnSchedulingChange()) this..signalSchedulingChange(); 
 /*      */   }
 /*      */ 
 /*      */   private List buildTriggerListenerList(String[] additionalLstnrs)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1500 */     List triggerListeners = getGlobalTriggerListeners();
 /* 1501 */     for (int i = 0; i < additionalLstnrs.lengthi++) {
 /* 1502 */       TriggerListener tl = getTriggerListener(additionalLstnrs[i]);
 /*      */ 
 /* 1504 */       if (tl != nulltriggerListeners.add(tl);
 /*      */       else {
 /* 1506 */         throw new SchedulerException("TriggerListener '" + additionalLstnrs[i] + "' not found.", 710);
 /*      */       }
 /*      */ 
 /*      */     }
 /*      */ 
 /* 1511 */     return triggerListeners;
 /*      */   }
 /*      */ 
 /*      */   private List buildJobListenerList(String[] additionalLstnrsthrows SchedulerException
 /*      */   {
 /* 1516 */     List jobListeners = getGlobalJobListeners();
 /* 1517 */     for (int i = 0; i < additionalLstnrs.lengthi++) {
 /* 1518 */       JobListener jl = getJobListener(additionalLstnrs[i]);
 /*      */ 
 /* 1520 */       if (jl != nulljobListeners.add(jl);
 /*      */       else {
 /* 1522 */         throw new SchedulerException("JobListener '" + additionalLstnrs[i] + "' not found.", 610);
 /*      */       }
 /*      */ 
 /*      */     }
 /*      */ 
 /* 1527 */     return jobListeners;
 /*      */   }
 /*      */ 
 /*      */   public boolean notifyTriggerListenersFired(JobExecutionContext jec)
 /*      */     throws SchedulerException
 /*      */   {
 /* 1533 */     List triggerListeners = buildTriggerListenerList(jec.getTrigger().getTriggerListenerNames());