Package org.quartz.impl

Examples of org.quartz.impl.StdSchedulerFactory


   private Scheduler scheduler;

   @Create
   public void initScheduler() throws SchedulerException
   {
       StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();

       //TODO: magical properties files are *not* the way to config Seam apps!
       InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("seam.quartz.properties");
       if (is != null)
       {
         schedulerFactory.initialize(is);
         log.debug("Found seam.quartz.properties file. Using it for Quartz config.");
       }
       else
       {
         schedulerFactory.initialize();
         log.warn("No seam.quartz.properties file. Using in-memory job store.");
       }
   
       scheduler = schedulerFactory.getScheduler();
       scheduler.start();
   }
View Full Code Here


     */
    @Inject
    public SchedulerProvider( SchedulerConfiguration schedulerConfiguration )
        throws SchedulerException
    {
        StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();

        if ( schedulerConfiguration.getProperties() != null )
        {
            schedulerFactory.initialize( schedulerConfiguration.getProperties() );
        }

        this.scheduler = schedulerFactory.getScheduler();

        if ( !schedulerConfiguration.startManually() )
        {
            scheduler.start();
        }
View Full Code Here

        if (prop != null) {

            // force disabling update checker (will do online check over the internet)
            prop.put("org.quartz.scheduler.skipUpdateCheck", "true");

            answer = new StdSchedulerFactory(prop);
        } else {
            // read default props to be able to use a single scheduler per camel context
            // if we need more than one scheduler per context use setScheduler(Scheduler)
            // or setFactory(SchedulerFactory) methods

            // must use classloader from StdSchedulerFactory to work even in OSGi
            InputStream is = StdSchedulerFactory.class.getClassLoader().getResourceAsStream("org/quartz/quartz.properties");
            if (is == null) {
                throw new SchedulerException("Quartz properties file not found in classpath: org/quartz/quartz.properties");
            }
            prop = new Properties();
            try {
                prop.load(is);
            } catch (IOException e) {
                throw new SchedulerException("Error loading Quartz properties file from classpath: org/quartz/quartz.properties", e);
            }

            // camel context name will be a suffix to use one scheduler per context
            String identity = getCamelContext().getName();

            String instName = prop.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME);
            if (instName == null) {
                instName = "scheduler-" + identity;
            } else {
                instName = instName + "-" + identity;
            }
            prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);

            // force disabling update checker (will do online check over the internet)
            prop.put("org.quartz.scheduler.skipUpdateCheck", "true");

            answer = new StdSchedulerFactory(prop);
        }

        if (LOG.isDebugEnabled()) {
            String name = prop.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME);
            LOG.debug("Creating SchedulerFactory: {} with properties: {}", name, prop);
View Full Code Here

            if (enableJmx && !prop.containsKey("org.quartz.scheduler.jmx.export")) {
                prop.put("org.quartz.scheduler.jmx.export", "true");
                LOG.info("Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX.");
            }

            answer = new StdSchedulerFactory(prop);
        } else {
            // read default props to be able to use a single scheduler per camel context
            // if we need more than one scheduler per context use setScheduler(Scheduler)
            // or setFactory(SchedulerFactory) methods

            // must use classloader from StdSchedulerFactory to work even in OSGi
            InputStream is = StdSchedulerFactory.class.getClassLoader().getResourceAsStream("org/quartz/quartz.properties");
            if (is == null) {
                throw new SchedulerException("Quartz properties file not found in classpath: org/quartz/quartz.properties");
            }
            prop = new Properties();
            try {
                prop.load(is);
            } catch (IOException e) {
                throw new SchedulerException("Error loading Quartz properties file from classpath: org/quartz/quartz.properties", e);
            } finally {
                IOHelper.close(is);
            }

            // camel context name will be a suffix to use one scheduler per context
            String instName = createInstanceName(prop);
            prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);

            // force disabling update checker (will do online check over the internet)
            prop.put("org.quartz.scheduler.skipUpdateCheck", "true");
            prop.put("org.terracotta.quartz.skipUpdateCheck", "true");

            // enable jmx unless configured to not do so
            if (enableJmx && !prop.containsKey("org.quartz.scheduler.jmx.export")) {
                prop.put("org.quartz.scheduler.jmx.export", "true");
                LOG.info("Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX.");
            }

            answer = new StdSchedulerFactory(prop);
        }

        if (LOG.isDebugEnabled()) {
            String name = prop.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME);
            LOG.debug("Creating SchedulerFactory: {} with properties: {}", name, prop);
View Full Code Here

            if (enableJmx && !prop.containsKey("org.quartz.scheduler.jmx.export")) {
                LOG.info("Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX.");
                prop.put("org.quartz.scheduler.jmx.export", "true");
            }

            answer = new StdSchedulerFactory(prop);
        } else {
            // read default props to be able to use a single scheduler per camel context
            // if we need more than one scheduler per context use setScheduler(Scheduler)
            // or setFactory(SchedulerFactory) methods

            // must use classloader from StdSchedulerFactory to work even in OSGi
            InputStream is = StdSchedulerFactory.class.getClassLoader().getResourceAsStream("org/quartz/quartz.properties");
            if (is == null) {
                throw new SchedulerException("Quartz properties file not found in classpath: org/quartz/quartz.properties");
            }
            prop = new Properties();
            try {
                prop.load(is);
            } catch (IOException e) {
                throw new SchedulerException("Error loading Quartz properties file from classpath: org/quartz/quartz.properties", e);
            } finally {
                IOHelper.close(is);
            }

            // camel context name will be a suffix to use one scheduler per context
            String instName = createInstanceName(prop);
            prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);

            // force disabling update checker (will do online check over the internet)
            prop.put("org.quartz.scheduler.skipUpdateCheck", "true");

            // enable jmx unless configured to not do so
            if (enableJmx && !prop.containsKey("org.quartz.scheduler.jmx.export")) {
                prop.put("org.quartz.scheduler.jmx.export", "true");
                LOG.info("Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX.");
            }

            answer = new StdSchedulerFactory(prop);
        }

        if (LOG.isDebugEnabled()) {
            String name = prop.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME);
            LOG.debug("Creating SchedulerFactory: {} with properties: {}", name, prop);
View Full Code Here

    }

    private static void initializeQuartz() throws SchedulerException,
            ParseException, ClassNotFoundException {
        Logger log = Logger.getLogger(XPlannerInitializationPlugin.class);
        StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
        Properties schedulerProperties = new XPlannerProperties().get();
        schedulerFactory.initialize(schedulerProperties);
        Scheduler jobScheduler = schedulerFactory.getScheduler();
        Enumeration propertyNames = schedulerProperties.propertyNames();
        while (propertyNames.hasMoreElements()) {
            String name = (String)propertyNames.nextElement();
            if (name.endsWith(".job")) {
                String value = (String)schedulerProperties.get(name);
View Full Code Here

 
  /* (non-Javadoc)
   * @see it.eng.spago.init.InitializerIFace#init(it.eng.spago.base.SourceBean)
   */
  public void init(SourceBean config) {
    StdSchedulerFactory stdSchedFact = new StdSchedulerFactory();
      Properties properties = new Properties();
      try{
        Thread currThread = Thread.currentThread();
        ClassLoader classLoader = currThread.getContextClassLoader();
        InputStream propIs = classLoader.getResourceAsStream("quartz.properties");
          properties.load(propIs);
          stdSchedFact.initialize(properties);
          Scheduler sched = stdSchedFact.getScheduler();
          sched.start();
      } catch (Exception e) {
        SpagoBITracer.major(SpagoBIConstants.NAME_MODULE, this.getClass().getName(),
                        "init", "Error while initializing scheduler " + e);
      }
View Full Code Here

     */
    public QuartzSchedulerImpl(final BrokerPool brokerpool, final Configuration config) throws EXistException {
        this.brokerPool = brokerpool;
        this.config = config;
        try {
            final SchedulerFactory schedulerFactory = new StdSchedulerFactory(getQuartzProperties());
            scheduler = schedulerFactory.getScheduler();
        } catch(final SchedulerException se) {
            throw(new EXistException("Unable to create Scheduler: " + se.getMessage(), se));
        }
    }
View Full Code Here

    try {

      getLog().info("------- Iniciando -------------------");

      // First we must get a reference to a scheduler
      SchedulerFactory sf = new StdSchedulerFactory();
      Scheduler sched = sf.getScheduler();

      getLog().info("------- Inicialização Completa --------");

      getLog().info("------- Agendando Tarefas ----------------");
View Full Code Here

     */
    private Scheduler scheduler;

    public EasyBatchScheduler(EasyBatchEngine easyBatchEngine) throws EasyBatchSchedulerException {
        JobFactory jobFactory = new EasyBatchJobFactory(easyBatchEngine);
        SchedulerFactory schedulerFactory = new StdSchedulerFactory();
        try {
            scheduler = schedulerFactory.getScheduler();
            scheduler.setJobFactory(jobFactory);
        } catch (SchedulerException e) {
            throw new EasyBatchSchedulerException("An exception occurred during scheduler setup", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.quartz.impl.StdSchedulerFactory

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.