Exemplo n.º 1
0
 public void initialize() throws TaskSystemException {
   try {
     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     DocumentBuilder builder = factory.newDocumentBuilder();
     Document document = builder.parse(getTaskConfigurationInputSource());
     NodeList rootElement =
         document.getElementsByTagName(SchedulerConstants.SPRING_BEANS_FILE_ROOT_TAG);
     if (rootElement.getLength() > 0) { // new Quartz scheduler
       springTaskContext =
           new FileSystemXmlApplicationContext("file:" + getTaskConfigurationFilePath());
       scheduler =
           (Scheduler) springTaskContext.getBean(SchedulerConstants.SPRING_SCHEDULER_BEAN_NAME);
       jobExplorer =
           (JobExplorer) springTaskContext.getBean(SchedulerConstants.JOB_EXPLORER_BEAN_NAME);
       jobRepository =
           (JobRepository) springTaskContext.getBean(SchedulerConstants.JOB_REPOSITORY_BEAN_NAME);
       jobLauncher =
           (JobLauncher) springTaskContext.getBean(SchedulerConstants.JOB_LAUNCHER_BEAN_NAME);
       jobLocator =
           (JobLocator) springTaskContext.getBean(SchedulerConstants.JOB_LOCATOR_BEAN_NAME);
     } else { // old legacy Mifos Scheduler
       StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
       String configPath = getQuartzSchedulerConfigurationFilePath();
       schedulerFactory.initialize(configPath);
       scheduler = schedulerFactory.getScheduler();
       if (!scheduler.isInStandbyMode()) {
         scheduler.standby();
       }
       registerTasksOldConfigurationFile(document);
       scheduler.start();
     }
   } catch (Exception e) {
     throw new TaskSystemException(e);
   }
 }
Exemplo n.º 2
0
  public boolean activate() {
    try {
      if (scheduler != null && scheduler.isInStandbyMode()) {
        if (logger.isDebugEnabled()) {
          logger.debug("Starting Message Processor Scheduler : " + scheduler.getMetaData());
        }

        scheduler.start();

        if (this.isPaused()) {
          resumeService();
        }

        if (logger.isDebugEnabled()) {
          logger.debug("Successfully re-activated the message processor [" + getName() + "]");
        }

        setActivated(isActive());

        return true;
      } else {
        return false;
      }
    } catch (SchedulerException e) {
      throw new SynapseException("Error Standing-by Message processor scheduler ", e);
    }
  }
Exemplo n.º 3
0
 public boolean isDeactivated() {
   try {
     return scheduler.isInStandbyMode();
   } catch (SchedulerException e) {
     throw new SynapseException("Error Standing-by Message processor scheduler ", e);
   }
 }
  protected boolean isEnabled(StorageType storageType) throws SchedulerException {

    if (!isEnabled()) {
      return false;
    }

    Scheduler scheduler = getScheduler(storageType);

    try {
      if (scheduler.isShutdown() || scheduler.isInStandbyMode()) {
        return false;
      }
    } catch (org.quartz.SchedulerException se) {
      throw new SchedulerException(se);
    }

    return true;
  }