本文整理汇总了Java中org.quartz.impl.StdSchedulerFactory.getScheduler方法的典型用法代码示例。如果您正苦于以下问题:Java StdSchedulerFactory.getScheduler方法的具体用法?Java StdSchedulerFactory.getScheduler怎么用?Java StdSchedulerFactory.getScheduler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.impl.StdSchedulerFactory
的用法示例。
在下文中一共展示了StdSchedulerFactory.getScheduler方法的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: init
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* Init servlet
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
schedFact = new StdSchedulerFactory("soa_quartz.properties");
sched = schedFact.getScheduler();
System.out.println(this.getClass().getName() + " started");
sched.start();
// Create Master Dispatch job
JobDetail jd = new JobDetail(MASTER_JOB_NAME, GROUP_NAME, MasterSOAJob.class);
int repeatInterval = Integer.parseInt(getInitParameter("TRIGGER_REPEATINTERVAL"));
System.out.println(this.getClass().getName() + " Repeat interval for " + MASTER_JOB_NAME + ": " + repeatInterval + " milliseconds");
SimpleTrigger simpleTrigger = new SimpleTrigger(MASTER_TRIGGER_NAME, GROUP_NAME, SimpleTrigger.REPEAT_INDEFINITELY, repeatInterval);
System.out.println(this.getClass().getName() + " Scheduling Job " + MASTER_JOB_NAME);
sched.scheduleJob(jd, simpleTrigger);
System.out.println(this.getClass().getName() + " Job " + MASTER_JOB_NAME + " scheduled");
} catch (Exception e) {
System.err.println(this.getClass().getName() + " " + e.getLocalizedMessage());
e.printStackTrace(System.err);
}
}
示例6: 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");
}
示例7: 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));
}
}
示例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("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");
}
示例9: 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");
}
示例10: startScheduler
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* The init method is called when this plugin is initialized
* <P>
* @param actionServlet The struts ActionServlet
* @param moduleConfig The struts ModuleConfig
*/
public static void startScheduler(ServletContext context)
{
// The Quartz Scheduler
Scheduler scheduler = null;
// Retrieve the factory from the ServletContext.
// It will be put there by the Quartz Servlet
StdSchedulerFactory factory = (StdSchedulerFactory)
context.getAttribute(QuartzInitializerServlet.QUARTZ_FACTORY_KEY);
try
{
// Retrieve the scheduler from the factory
scheduler = factory.getScheduler();
scheduler.start();
}
catch (Exception e)
{
logger.error("Error setting up scheduler: " + e.getMessage());
}
sm_scheduler = scheduler;
}
示例11: 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);
}
}
示例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: start
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@Override
public void start(String resource) throws Throwable {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
log.info("timer client component starting, version: " + Version.getVersion());
log.info("*** Start parsing: " + resource);
parse(resource);// "config.xml"
schedulerfactory = new StdSchedulerFactory();
scheduler = schedulerfactory.getScheduler();
register();
scheduler.start();
log.info("timer client component successfully.");
}
示例14: instantiateSchedulerFactory
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
/**
* <p>
* Initialize the <code>{@link org.quartz.SchedulerFactory}</code> with the
* contents of the given <code>Properties</code> object.
* </p>
*/
public void instantiateSchedulerFactory() {
final StdSchedulerFactory factory = new StdSchedulerFactory();
try {
scheduler = factory.getScheduler();
} catch (SchedulerException e) {
LOGGER.error(INITIALIZE_ERROR, e);
}
}
示例15: KairosDBSchedulerImpl
import org.quartz.impl.StdSchedulerFactory; //导入方法依赖的package包/类
@Inject
public KairosDBSchedulerImpl(Injector guice) throws SchedulerException
{
this.guice = guice;
Properties props = new Properties();
props.setProperty("org.quartz.threadPool.threadCount", "4");
props.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK, "true");
StdSchedulerFactory factory = new StdSchedulerFactory(props);
scheduler = factory.getScheduler();
scheduler.setJobFactory(new KairosDBJobFactory(guice));
}