@Override public void initialize() throws SchedulerConfigException { // Absolutely needs thread-bound Executor to initialize. this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor(); if (this.taskExecutor == null) { throw new SchedulerConfigException("No local Executor found for configuration - " + "'taskExecutor' property must be set on SchedulerFactoryBean"); } }
private Class<?> loadClass(String className) throws ClassNotFoundException, SchedulerConfigException { try { ClassLoader cl = findClassloader(); if(cl != null) return cl.loadClass(className); throw new SchedulerConfigException("Unable to find a class loader on the current thread or class."); } catch (ClassNotFoundException e) { if(getClass().getClassLoader() != null) return getClass().getClassLoader().loadClass(className); throw e; } }
private Class<?> loadClass(String className) throws ClassNotFoundException, SchedulerConfigException { try { ClassLoader cl = findClassloader(); if(cl != null) return cl.loadClass(className); throw new SchedulerConfigException("Unable to find a class loader on the current thread or class."); } catch (ClassNotFoundException e) { if(getClass().getClassLoader() != null) return getClass().getClassLoader().loadClass(className); throw e; } }
@Override public void initialize() throws SchedulerConfigException { // Absolutely needs thread-bound Executor to initialize. this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor(); if (this.taskExecutor == null) { throw new SchedulerConfigException("No local Executor found for configuration - " + "'taskExecutor' property must be set on SchedulerFactoryBean"); } }
@Override public void stopService() throws Exception { log.info("Stop QuartzService(" + jndiName + ")..."); try { Scheduler scheduler = schedulerFactory.getScheduler(); scheduler.shutdown(); } catch (Exception e) { log.error("Failed to shutdown Scheduler", e); throw new SchedulerConfigException( "Failed to shutdown Scheduler - ", e); } unbind(jndiName); log.info("QuartzService(" + jndiName + ") stopped."); }
@Override public void stopService() throws Exception { log.info("Stop QuartzService(" + jndiName + ")..."); try { Scheduler scheduler = schedulerFactory.getScheduler(); scheduler.shutdown(); } catch (Exception e) { log.error("Failed to shutdown Scheduler", e); throw new SchedulerConfigException( "Failed to shutdown Scheduler - ", e); } unbind(jndiName); log.info("QuartzService(" + jndiName + ") stopped."); }
@Override public void startService() throws Exception { log.info("Start QuartzService(" + jndiName + ")..."); try { rebind(); } catch (NamingException ne) { log.error("Failed to rebind Scheduler", ne); throw new SchedulerConfigException("Failed to rebind Scheduler - ", ne); } try { Scheduler scheduler = schedulerFactory.getScheduler(); if (startScheduler) { scheduler.start(); } else { log.info("Skipping starting the scheduler (will not run jobs)."); } } catch (Exception e) { log.error("Failed to start Scheduler", e); throw new SchedulerConfigException("Failed to start Scheduler - ", e); } log.info("QuartzService(" + jndiName + ") started."); }
@Override public void startService() throws Exception { log.info("Start QuartzService(" + jndiName + ")..."); try { rebind(); } catch (NamingException ne) { log.error("Failed to rebind Scheduler", ne); throw new SchedulerConfigException("Failed to rebind Scheduler - ", ne); } try { Scheduler scheduler = schedulerFactory.getScheduler(); if (startScheduler) { scheduler.start(); } else { log.info("Skipping starting the scheduler (will not run jobs)."); } } catch (Exception e) { log.error("Failed to start Scheduler", e); throw new SchedulerConfigException("Failed to start Scheduler - ", e); } log.info("QuartzService(" + jndiName + ") started."); }
@Override public void createService() throws Exception { log.info("Create QuartzService(" + jndiName + ")..."); if (error) { log .error("Must specify only one of 'Properties' or 'PropertiesFile'"); throw new Exception( "Must specify only one of 'Properties' or 'PropertiesFile'"); } schedulerFactory = new StdSchedulerFactory(); try { if (useProperties) { schedulerFactory.initialize(properties); } if (usePropertiesFile) { schedulerFactory.initialize(propertiesFile); } } catch (Exception e) { log.error("Failed to initialize Scheduler", e); throw new SchedulerConfigException( "Failed to initialize Scheduler - ", e); } log.info("QuartzService(" + jndiName + ") created."); }
@Override public void createService() throws Exception { log.info("Create QuartzService(" + jndiName + ")..."); if (error) { log .error("Must specify only one of 'Properties' or 'PropertiesFile'"); throw new Exception( "Must specify only one of 'Properties' or 'PropertiesFile'"); } schedulerFactory = new StdSchedulerFactory(); try { if (useProperties) { schedulerFactory.initialize(properties); } if (usePropertiesFile) { schedulerFactory.initialize(propertiesFile); } } catch (Exception e) { log.error("Failed to initialize Scheduler", e); throw new SchedulerConfigException( "Failed to initialize Scheduler - ", e); } log.info("QuartzService(" + jndiName + ") created."); }
public void setJndiName(String jndiName) throws Exception { String oldName = this.jndiName; this.jndiName = jndiName; if (super.getState() == STARTED) { unbind(oldName); try { rebind(); } catch (NamingException ne) { log.error("Failed to rebind Scheduler", ne); throw new SchedulerConfigException( "Failed to rebind Scheduler - ", ne); } } }
public void setJndiName(String jndiName) throws Exception { String oldName = this.jndiName; this.jndiName = jndiName; if (super.getState() == STARTED) { unbind(oldName); try { rebind(); } catch (NamingException ne) { log.error("Failed to rebind Scheduler", ne); throw new SchedulerConfigException( "Failed to rebind Scheduler - ", ne); } } }
throw new SchedulerConfigException( "Thread count must be > 0"); throw new SchedulerConfigException( "Thread priority must be > 0 and <= 9");
private void init() throws SchedulerConfigException { if (realJobStore != null) { return; } if ((tcConfig != null) && (tcConfigUrl != null)) { // throw new SchedulerConfigException("Both " + TC_CONFIG_PROP + " and " + TC_CONFIGURL_PROP + " are set in your properties. Please define only one of them"); } if ((tcConfig == null) && (tcConfigUrl == null)) { // throw new SchedulerConfigException("Neither " + TC_CONFIG_PROP + " or " + TC_CONFIGURL_PROP + " are set in your properties. Please define one of them"); } final boolean isURLConfig = tcConfig == null; TerracottaToolkitBuilder toolkitBuilder = new TerracottaToolkitBuilder(); if (isURLConfig) { toolkitBuilder.setTCConfigUrl(tcConfigUrl); } else { toolkitBuilder.setTCConfigSnippet(tcConfig); } if (rejoin != null) { toolkitBuilder.setRejoin(rejoin); } toolkitBuilder.addTunnelledMBeanDomain("quartz"); toolkit = (ToolkitInternal) toolkitBuilder.buildToolkit(); try { realJobStore = getRealStore(toolkit); } catch (Exception e) { throw new SchedulerConfigException("Unable to create Terracotta client", e); } }
@Override public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException { if (nonManagedTxDsName == null) { throw new SchedulerConfigException( "Non-ManagedTX DataSource name not set! " + "If your 'org.quartz.jobStore.dataSource' is XA, then set " + "'org.quartz.jobStore.nonManagedTXDataSource' to a non-XA "+ "datasource (for the same DB). " + "Otherwise, you can set them to be the same."); } if (getLockHandler() == null) { // If the user hasn't specified an explicit lock handler, // then we *must* use DB locks with CMT... setUseDBLocks(true); } super.initialize(loadHelper, signaler); getLog().info("JobStoreCMT initialized."); }
private void init() throws SchedulerConfigException { if (realJobStore != null) { return; } if ((tcConfig != null) && (tcConfigUrl != null)) { // throw new SchedulerConfigException("Both " + TC_CONFIG_PROP + " and " + TC_CONFIGURL_PROP + " are set in your properties. Please define only one of them"); } if ((tcConfig == null) && (tcConfigUrl == null)) { // throw new SchedulerConfigException("Neither " + TC_CONFIG_PROP + " or " + TC_CONFIGURL_PROP + " are set in your properties. Please define one of them"); } final boolean isURLConfig = tcConfig == null; TerracottaToolkitBuilder toolkitBuilder = new TerracottaToolkitBuilder(); if (isURLConfig) { toolkitBuilder.setTCConfigUrl(tcConfigUrl); } else { toolkitBuilder.setTCConfigSnippet(tcConfig); } if (rejoin != null) { toolkitBuilder.setRejoin(rejoin); } toolkitBuilder.addTunnelledMBeanDomain("quartz"); toolkit = (ToolkitInternal) toolkitBuilder.buildToolkit(); try { realJobStore = getRealStore(toolkit); } catch (Exception e) { throw new SchedulerConfigException("Unable to create Terracotta client", e); } }
@Override public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException { if (nonManagedTxDsName == null) { throw new SchedulerConfigException( "Non-ManagedTX DataSource name not set! " + "If your 'org.quartz.jobStore.dataSource' is XA, then set " + "'org.quartz.jobStore.nonManagedTXDataSource' to a non-XA "+ "datasource (for the same DB). " + "Otherwise, you can set them to be the same."); } if (getLockHandler() == null) { // If the user hasn't specified an explicit lock handler, // then we *must* use DB locks with CMT... setUseDBLocks(true); } super.initialize(loadHelper, signaler); getLog().info("JobStoreCMT initialized."); }
/** * @see org.quartz.spi.JobStore#schedulerStarted() */ public void schedulerStarted() throws SchedulerException { if (isClustered()) { clusterManagementThread = new ClusterManager(); if(initializersLoader != null) clusterManagementThread.setContextClassLoader(initializersLoader); clusterManagementThread.initialize(); } else { try { recoverJobs(); } catch (SchedulerException se) { throw new SchedulerConfigException( "Failure occured during job recovery.", se); } } misfireHandler = new MisfireHandler(); if(initializersLoader != null) misfireHandler.setContextClassLoader(initializersLoader); misfireHandler.initialize(); schedulerRunning = true; getLog().debug("JobStore background threads started (as scheduler was started)."); }
/** * @see org.quartz.spi.JobStore#schedulerStarted() */ public void schedulerStarted() throws SchedulerException { if (isClustered()) { clusterManagementThread = new ClusterManager(); if(initializersLoader != null) clusterManagementThread.setContextClassLoader(initializersLoader); clusterManagementThread.initialize(); } else { try { recoverJobs(); } catch (SchedulerException se) { throw new SchedulerConfigException( "Failure occured during job recovery.", se); } } misfireHandler = new MisfireHandler(); if(initializersLoader != null) misfireHandler.setContextClassLoader(initializersLoader); misfireHandler.initialize(); schedulerRunning = true; getLog().debug("JobStore background threads started (as scheduler was started)."); }
throw new SchedulerConfigException("No local DataSource found for configuration - " + "'dataSource' property must be set on SchedulerFactoryBean");