本文整理汇总了Java中org.quartz.impl.StdSchedulerFactory.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java StdSchedulerFactory.initialize方法的具体用法?Java StdSchedulerFactory.initialize怎么用?Java StdSchedulerFactory.initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.impl.StdSchedulerFactory
的用法示例。
在下文中一共展示了StdSchedulerFactory.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doStartup
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* Starts up this event scheduler.
*/
@Override
public void doStartup() {
try {
Properties props = new Properties();
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, getName());
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID, getName());
props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
// There should be only one thread here to ensure the proper order of scheduled events.
props.put(PROP_THREAD_COUNT, Integer.toString(1));
StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
schedulerFactory.initialize(props);
scheduler = schedulerFactory.getScheduler();
scheduler.start();
} catch (SchedulerException e) {
throw SpongeUtils.wrapException(getName(), e);
}
}
示例2: DefaultTaskScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public DefaultTaskScheduler() {
StdSchedulerFactory schedFactory = new StdSchedulerFactory();
Properties props = new Properties();
props.setProperty("org.quartz.scheduler.instanceName", "DefaultQuartzScheduler");
props.setProperty("org.quartz.scheduler.rmi.export", "false");
props.setProperty("org.quartz.scheduler.rmi.proxy", "false");
props.setProperty("org.quartz.scheduler.wrapJobExecutionInUserTransaction", "false");
props.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
props.setProperty("org.quartz.threadPool.threadCount", "10");
props.setProperty("org.quartz.jobStore.misfireThreshold", "60000");
props.setProperty("org.quartz.jobStore.class", "org.quartz.simpl.RAMJobStore");
try {
schedFactory.initialize(props);
quartz = schedFactory.getScheduler();
} catch (SchedulerException e) {
throw new RuntimeException(e);
}
}
示例3: newScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected Scheduler newScheduler()throws SchedulerException{
StdSchedulerFactory factory=new StdSchedulerFactory();
Properties mergedProps = new Properties();
mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
mergedProps.setProperty("org.quartz.scheduler.instanceName", "BDF2Scheduler");
mergedProps.setProperty("org.quartz.scheduler.instanceId", "CoreBDF2Scheduler");
mergedProps.setProperty("org.quartz.scheduler.makeSchedulerThreadDaemon", makeSchedulerThreadDaemon);
mergedProps.setProperty("org.quartz.threadPool.threadCount", Integer.toString(threadCount));
if (this.configLocation != null) {
try {
PropertiesLoaderUtils.fillProperties(mergedProps, this.configLocation);
} catch (IOException e) {
e.printStackTrace();
}
}
factory.initialize(mergedProps);
Scheduler scheduler=factory.getScheduler();
Collection<JobExecutionListener> jobListeners = this.getApplicationContext().getBeansOfType(JobExecutionListener.class).values();
for(JobExecutionListener jobListener:jobListeners){
jobListener.setSessionFactory(getSessionFactory());
scheduler.getListenerManager().addJobListener(jobListener);
}
return scheduler;
}
示例4: init
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public void init(int port){
log.info("init begin");
try {
StdSchedulerFactory stdSchedulerFactory = new StdSchedulerFactory();
stdSchedulerFactory.initialize("zeusQuartz.properties");
scheduler = stdSchedulerFactory.getScheduler();
scheduler.start();
} catch (SchedulerException e) {
ScheduleInfoLog.error("schedule start fail", e);
}
dispatcher=new Dispatcher();
handler=new MasterHandler(this);
server=new MasterServer(handler);
server.start(port);
master=new Master(this);
log.info("init finish");
}
示例5: initInternal
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected void initInternal() {
try {
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(QUARTZ_PROPERTY_FILE_NAME);
scheduler = factory.getScheduler();
// Register job listener to bound request context to every job
// execution
scheduler.getListenerManager().addJobListener(jobListener, EverythingMatcher.allJobs());
// Replace default job factory
scheduler.setJobFactory(jobFactory);
} catch (SchedulerException ex) {
throw new IllegalStateException("Failed to initialize Quartz scheduler manager", ex);
}
log.info("Quartz scheduler manager initialized");
}
示例6: startup
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
public static Scheduler startup(Properties props) throws SchedulerException {
String schedname = props.getProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, "QuartzScheduler");
SchedulerRepository schedRep = SchedulerRepository.getInstance();
Scheduler scheduler = schedRep.lookup(schedname);
if (scheduler == null || scheduler.isShutdown()) {
logger.info("Initializing Scheduler...");
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(props);
scheduler = factory.getScheduler();
logger.info("Scheduler has been initialized...");
return scheduler;
} else {
throw new SchedulerException(MessageFormat.format("Scheduler with name \"{0}\" already exists. Choose a different name.", schedname));
}
}
示例7: initScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initScheduler(boolean activated) {
logger.debug("initScheduler - START");
if (!activated) {
logger.error("Scheduler deactivated !");
return;
}
try {
// create scheduler
StdSchedulerFactory sf = new StdSchedulerFactory();
ClassLoader loader = this.getClass().getClassLoader();
sf.initialize(loader.getResourceAsStream(ConfigParametersProvider.getString("config", IConstant.SCHEDULER_CONFIG_FILE_LOCATION)));
Scheduler sched = sf.getScheduler();
sched.start();
logger.info("Scheduler started!");
CMContext.storeOnContext(IConstant.SCHEDULER, sched);
} catch (SchedulerException e) {
logger.error("", e);
}
logger.debug("initScheduler - END");
}
示例8: initScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initScheduler(boolean activated) {
logger.debug("initScheduler - START");
if (!activated) {
logger.error("Scheduler deactivated !");
return;
}
try {
// create scheduler
StdSchedulerFactory sf = new StdSchedulerFactory();
ClassLoader loader = this.getClass().getClassLoader();
sf.initialize(loader.getResourceAsStream(ConfigParametersProvider.getString("business", IConstant.SCHEDULER_CONFIG_FILE_LOCATION)));
Scheduler sched = sf.getScheduler();
sched.start();
logger.info("Scheduler started!");
OMContext.storeOnContext(IConstant.SCHEDULER, sched);
} catch (SchedulerException e) {
logger.error("", e);
}
logger.debug("initScheduler - END");
}
示例9: getScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private Scheduler getScheduler() {
StdSchedulerFactory factory = new StdSchedulerFactory();
try {
factory.initialize(getQuartzProperties());
return factory.getScheduler();
} catch (final SchedulerException ex) {
throw new JobSystemException(ex);
}
}
示例10: StatisticsScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* 构造函数.
*/
StatisticsScheduler() {
factory = new StdSchedulerFactory();
try {
factory.initialize(getQuartzProperties());
} catch (final SchedulerException ex) {
throw new JobStatisticException(ex);
}
}
示例11: createService
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@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.");
}
示例12: quartzScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* Setup quartz scheduler
*/
@Bean
public Scheduler quartzScheduler() {
try {
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(new ClassPathResource("quartz.properties").getInputStream());
return factory.getScheduler();
} catch (SchedulerException | IOException e) {
throw new IllegalStatusException("Unable to init quartz: " + e.getMessage());
}
}
示例13: initDetectionScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initDetectionScheduler() throws Exception{
StdSchedulerFactory factory=new StdSchedulerFactory();
Properties mergedProps = new Properties();
mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
mergedProps.setProperty("org.quartz.scheduler.instanceName", "BDF2HeartbeatScheduler");
mergedProps.setProperty("org.quartz.scheduler.instanceId", "HeartbeatDetectionScheduler");
mergedProps.setProperty("org.quartz.threadPool.threadCount","1");
factory.initialize(mergedProps);
scheduler=factory.getScheduler();
}
示例14: initDetectionScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
private void initDetectionScheduler() throws Exception{
StdSchedulerFactory factory=new StdSchedulerFactory();
Properties mergedProps = new Properties();
mergedProps.setProperty(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
mergedProps.setProperty("org.quartz.scheduler.makeSchedulerThreadDaemon", "true");
mergedProps.setProperty("org.quartz.scheduler.instanceName", "UfloClusterHeartbeatScheduler");
mergedProps.setProperty("org.quartz.scheduler.instanceId", "UfloHeartbeatDetectionScheduler");
mergedProps.setProperty("org.quartz.threadPool.threadCount","2");
factory.initialize(mergedProps);
scheduler=factory.getScheduler();
}
示例15: initScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
protected void initScheduler(Properties properties) {
this.properties = properties;
try {
StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
schedulerFactory.initialize(properties);
scheduler = schedulerFactory.getScheduler();
scheduler.start();
} catch (SchedulerException e) {
LoggerHelper.error("create scheduler failed.", e);
throw new NiubiException(e);
}
}