Package org.springframework.scheduling.quartz

Examples of org.springframework.scheduling.quartz.SchedulerFactoryBean


        Properties properties = new Properties();
        PropertiesStringWriter.write(properties, "org.quartz.threadPool.threadCount", 1);
        PropertiesStringWriter.write(properties, "org.quartz.threadPool.threadPriority", Thread.NORM_PRIORITY);
        PropertiesStringWriter.write(properties, "org.quartz.scheduler.skipUpdateCheck", true);

        SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
        schedulerFactoryBean.setAutoStartup(false);
        schedulerFactoryBean.setWaitForJobsToCompleteOnShutdown(false);
        schedulerFactoryBean.setQuartzProperties(properties);
        schedulerFactoryBean.afterPropertiesSet();

        queue = new LinkedBlockingQueue<AutomaticJobExecutionParameters>();

        ScheduleJobExecutorService scheduleJobExecutorService = new ScheduleJobExecutorServiceMock(queue);

        QzerverJobListener qzerverJobListener = new QzerverJobListener();
        qzerverJobListener.setExecutorService(scheduleJobExecutorService);

        scheduler = schedulerFactoryBean.getObject();
        scheduler.getListenerManager().addJobListener(qzerverJobListener, EverythingMatcher.allJobs());

        quartzManagementService = new QuartzManagementServiceImpl();
        quartzManagementService.setScheduler(scheduler);
    }
View Full Code Here


      try {
        ctx = new ClassPathXmlApplicationContext("openmeetings-applicationContext.xml");
      } catch (Exception e) {
        handleError("Unable to obtain application context", e);
      }
      SchedulerFactoryBean sfb = ctx.getBean(SchedulerFactoryBean.class);
      try {
        sfb.getScheduler().shutdown(false);
      } catch (Exception e) {
        handleError("Unable to shutdown schedulers", e);
      }
    }
    return ctx;
View Full Code Here

      try {
        ctx = new ClassPathXmlApplicationContext("openmeetings-applicationContext.xml");
      } catch (Exception e) {
        handleError("Unable to obtain application context", e);
      }
      SchedulerFactoryBean sfb = ctx.getBean(SchedulerFactoryBean.class);
      try {
        sfb.getScheduler().shutdown(false);
      } catch (Exception e) {
        handleError("Unable to shutdown schedulers", e);
      }
    }
    return ctx;
View Full Code Here

      try {
        ctx = new ClassPathXmlApplicationContext("openmeetings-applicationContext.xml");
      } catch (Exception e) {
        handleError("Unable to obtain application context", e);
      }
      SchedulerFactoryBean sfb = ctx.getBean(SchedulerFactoryBean.class);
      try {
        sfb.getScheduler().shutdown(false);
      } catch (Exception e) {
        handleError("Unable to shutdown schedulers", e);
      }
    }
    return ctx;
View Full Code Here

      try {
        ctx = new ClassPathXmlApplicationContext("openmeetings-applicationContext.xml");
      } catch (Exception e) {
        handleError("Unable to obtain application context", e);
      }
      SchedulerFactoryBean sfb = ctx.getBean(SchedulerFactoryBean.class);
      try {
        sfb.getScheduler().shutdown(false);
      } catch (Exception e) {
        handleError("Unable to shutdown schedulers", e);
      }
    }
    return ctx;
View Full Code Here

        }
        return sb.toString();
    }

    private Scheduler createScheduler(final String name, final int noOfThreads, JobListener... jobListeners) throws Exception {
        final SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
        schedulerFactoryBean.setSchedulerName(name);
        schedulerFactoryBean.setGlobalJobListeners(jobListeners);
        final TriggerListener[] globalTriggerListeners = { globalSchedulerTriggerListener };
        schedulerFactoryBean.setGlobalTriggerListeners(globalTriggerListeners);
        final Properties quartzProperties = new Properties();
        quartzProperties.put(SchedulerFactoryBean.PROP_THREAD_COUNT, Integer.toString(noOfThreads));
        schedulerFactoryBean.setQuartzProperties(quartzProperties);
        schedulerFactoryBean.afterPropertiesSet();
        schedulerFactoryBean.start();
        return schedulerFactoryBean.getScheduler();
    }
View Full Code Here

  private boolean checkPassword(String pass) {
    return (pass == null || pass.length() < InstallationConfig.USER_PASSWORD_MINIMUM_LENGTH);
  }
 
  private void shutdownScheduledJobs(String ctxName) throws SchedulerException {
    SchedulerFactoryBean sfb =  getApplicationContext(ctxName).getBean(SchedulerFactoryBean.class);
    sfb.getScheduler().shutdown(false);
  }
View Full Code Here

  @RequestMapping("/control")
  public void control(@RequestParam(required=true) boolean close){
     /**修改定时状态*/
     reqClockStateChange(close);
     /**获取定时器工厂*/
     SchedulerFactoryBean schedulerFactory = (SchedulerFactoryBean) ctx.getBean("&myScheduler");
     try {
       if(close){
         /**若未恢复,则恢复**/
        schedulerFactory.getScheduler().resumeAll();
        Thread.sleep(3L * 1000L);
       }else{
         /**若未暂停,则暂停*/
         schedulerFactory.getScheduler().pauseAll();
         Thread.sleep(3L * 1000L);
       }
    } catch (SchedulerException e) {
      e.printStackTrace();
    } catch (Exception e) {
View Full Code Here

   
    Properties quartzProperties = new Properties();
    quartzProperties.setProperty(StdSchedulerFactory.PROP_SCHED_JMX_EXPORT, "true");
    quartzProperties.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK, "true");
   
    SchedulerFactoryBean schedulerBean = new SchedulerFactoryBean();
    schedulerBean.setWaitForJobsToCompleteOnShutdown(true);
    schedulerBean.setQuartzProperties(quartzProperties);
       
    repo.registerComponent(info, schedulerBean);
    repo.registerLifecycle(schedulerBean);
  }
View Full Code Here

TOP

Related Classes of org.springframework.scheduling.quartz.SchedulerFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.