Package org.quartz

Examples of org.quartz.SchedulerFactory


         return new String("Could not remove scheduler '" + name + "' because of exception : " + ex.getMessage());
      }
   }
  
   protected void doInit(Global glob, PluginInfo plugInfo) throws XmlBlasterException {
      SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
      try {
         String instanceName = getType();
         ContextNode contextNode = new ContextNode(ContextNode.SERVICE_MARKER_TAG, instanceName,
               this.global.getContextNode());
         if (!this.global.isRegisteredMBean(contextNode))
            this.mbeanHandle = this.global.registerMBean(contextNode, this);
        
         sched = schedFact.getScheduler();
         sched.start();
         String prefix = "scheduler.";
         Map map = InfoHelper.getPropertiesStartingWith(prefix, this, null);
         String[] keys = (String[])map.keySet().toArray( new String[map.size()]);
         for (int i=0; i < keys.length; i++) {
View Full Code Here


   */
  private Scheduler getScheduler()
  {
    if (_scheduler == null)
    {
      SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
      try
      {
        _scheduler = schedFact.getScheduler();
      }
      catch (SchedulerException e)
      {
        e.printStackTrace();
        _scheduler = null;
View Full Code Here

   */
  private Scheduler getScheduler()
  {
    if (_scheduler == null)
    {
      SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
      try
      {
        _scheduler = schedFact.getScheduler();
      }
      catch (SchedulerException e)
      {
        e.printStackTrace();
        _scheduler = null;
View Full Code Here

    public void configure() {
        try {
            prepareIniFile();

            Properties keeper = new Properties();
            SchedulerFactory sf = new StdSchedulerFactory();
            keeper.load(new FileInputStream("../main_config.ini"));

            Vars.mysql_host = keeper.getProperty("mysql_host");
            Vars.mysql_port = keeper.getProperty("mysql_port");
            Vars.mysql_db = keeper.getProperty("mysql_db");
            Vars.mysql_user = keeper.getProperty("mysql_user");
            Vars.mysql_password = keeper.getProperty("mysql_passwd");
            Vars.Mater_Lector = keeper.getProperty("Mater_Lector");
            Vars.Lector_Repository = keeper.getProperty("Lector_Repository");
            Vars.CronExpressionForIndexer = keeper.getProperty("CronExpressionForIndexer");
            Vars.dubl_remover_time = keeper.getProperty("dubl_remover_time");
            Vars.IndexerToUse = keeper.getProperty("IndexerToUse");
            Vars.Lucene_Repo = keeper.getProperty("Lucene_Repo");
            Vars.PathToTmpDir = keeper.getProperty("PathToTmpDir");
            Vars.max_threads = Integer.parseInt(keeper.getProperty("max_threads"));

            PropertyConfigurator.configure(props());
            Vars.logger = Logger.getRootLogger();

            if (System.getProperty("os.name").toUpperCase().contains("WIN")) {
                if (System.getProperty("os.arch").contains("x86")) {
                    Vars.os = 1;
                }
                if (System.getProperty("os.arch").contains("amd64")) {
                    Vars.os = 2;
                }
            }

            loadParsersFromXML();

            if (Vars.PathToTmpDir == null) {
                File tmpDir = new File("");
                tmpDir = new File(tmpDir.getAbsolutePath() + "/temp");
                if (tmpDir.mkdirs()) {
                    Vars.logger.info("Temporary directory successfully created");
                } else {
                    Vars.logger.warn("Temporary directory was not created!");
                }
                Vars.PathToTmpDir = tmpDir.getAbsolutePath().replace("\\", "/");
                tmpDir = null;
            }

            Vars.sched = sf.getScheduler();
            Vars.sched.start();
        } catch (Exception ex) {
            ex.printStackTrace();
            Vars.logger.fatal("Error: ", ex);
        }
View Full Code Here

        if (this.scheduler != null)
        {
            throw new UnsupportedOperationException("the scheduler is started already");
        }

        SchedulerFactory schedulerFactory = null;
        try
        {
            Properties properties = new Properties();
            properties.put(StdSchedulerFactory.PROP_SCHED_JOB_FACTORY_CLASS, CdiAwareJobFactory.class.getName());

            try
            {
                ResourceBundle config = loadCustomQuartzConfig();

                Enumeration<String> keys = config.getKeys();
                String key;
                while (keys.hasMoreElements())
                {
                    key = keys.nextElement();
                    properties.put(key, config.getString(key));
                }
            }
            catch (Exception e1)
            {
                LOG.info("no custom quartz-config file found. falling back to the default config provided by quartz.");

                InputStream inputStream = null;
                try
                {
                    inputStream = ClassUtils.getClassLoader(null).getResourceAsStream("org/quartz/quartz.properties");
                    properties.load(inputStream);
                }
                catch (Exception e2)
                {
                    LOG.warning("failed to load quartz default-config");
                    schedulerFactory = new StdSchedulerFactory();
                }
                finally
                {
                    if (inputStream != null)
                    {
                        inputStream.close();
                    }
                }
            }
            if (schedulerFactory == null)
            {
                schedulerFactory = new StdSchedulerFactory(properties);
            }
        }
        catch (Exception e)
        {
            LOG.log(Level.WARNING, "fallback to default scheduler-factory", e);
            schedulerFactory = new StdSchedulerFactory();
        }

        try
        {
            this.scheduler = schedulerFactory.getScheduler();
            final String startScopes = ConfigResolver
                    .getPropertyValue(START_SCOPES_KEY, "true");
            if ("true".equalsIgnoreCase(startScopes))
            {
                this.scheduler.getListenerManager().addJobListener(new InjectionAwareJobListener());
View Full Code Here

        }
        return schedulerFactory;
    }

    private SchedulerFactory createSchedulerFactory() throws SchedulerException {
        SchedulerFactory answer;

        Properties prop = loadProperties();
        if (prop != null) {

            // force disabling update checker (will do online check over the internet)
View Full Code Here

        }
        return answer;
    }

    protected SchedulerFactory createSchedulerFactory() throws SchedulerException {
        SchedulerFactory answer;

        Properties prop = loadProperties();
        if (prop != null) {

            // force disabling update checker (will do online check over the internet)
View Full Code Here

     */
    public SchedulerWrapper(String servletContextPath, String schedulerConfigurationPath) {
        this.servletContextPath = servletContextPath;
        this.schedulerConfigurationPath = schedulerConfigurationPath;

        SchedulerFactory factory = new StdSchedulerFactory();
        log.info("------- Starting up -----------------------");

        try {
            scheduler = factory.getScheduler();

            scheduler.addSchedulerListener(new AbstractSchedulerListener());
            scheduler.start();
        } catch (SchedulerException e) {
            log.error("Can't initialize SchedulerWrapper: ", e);
View Full Code Here

    protected void init() throws SchedulerException {
        // if we don't have a thread pool manager, we use the default thread pool
        final ThreadPoolManager tpm = this.threadPoolManager;
        if ( tpm == null ) {
            final SchedulerFactory factory = new StdSchedulerFactory();
            this.scheduler = factory.getScheduler();
        } else {
            final ThreadPool pool = tpm.get(THREAD_POOL_NAME);
            final QuartzThreadPool quartzPool = new QuartzThreadPool(pool);
            final DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
            factory.createScheduler(quartzPool, new RAMJobStore());
            this.scheduler = factory.getScheduler();
        }
        this.scheduler.start();
        if ( this.logger.isDebugEnabled() ) {
            this.logger.debug("Scheduler started.");
        }
View Full Code Here

  
   private final Scheduler scheduler_;

   public QuartzSheduler(ExoContainerContext ctx) throws Exception
   {
      final SchedulerFactory sf = new StdSchedulerFactory();

      try
      {
         scheduler_ = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Scheduler>()
         {
            public Scheduler run() throws Exception
            {
               return sf.getScheduler();
            }
         });
      }
      catch (PrivilegedActionException pae)
      {
View Full Code Here

TOP

Related Classes of org.quartz.SchedulerFactory

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.