本文整理汇总了Java中org.quartz.impl.DirectSchedulerFactory类的典型用法代码示例。如果您正苦于以下问题:Java DirectSchedulerFactory类的具体用法?Java DirectSchedulerFactory怎么用?Java DirectSchedulerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DirectSchedulerFactory类属于org.quartz.impl包,在下文中一共展示了DirectSchedulerFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initSched
import org.quartz.impl.DirectSchedulerFactory; //导入依赖的package包/类
public static void initSched(int threadCount) {
try {
SimpleThreadPool threadPool = new SimpleThreadPool(threadCount,
Thread.NORM_PRIORITY);
threadPool.initialize();
// create the job store
JobStore jobStore = new RAMJobStore();
DirectSchedulerFactory.getInstance().createScheduler(threadPool,
jobStore);
sched = DirectSchedulerFactory.getInstance().getScheduler();
//init heart sched
SimpleThreadPool threadPoolHeart = new SimpleThreadPool(1,
Thread.NORM_PRIORITY);
threadPoolHeart.initialize();
JobStore jobStoreHeart = new RAMJobStore();
DirectSchedulerFactory.getInstance().createScheduler("HeartScheduler", "SIMPLE_NON_CLUSTERED", threadPoolHeart,
jobStoreHeart);
heartSched = DirectSchedulerFactory.getInstance().getScheduler("HeartScheduler");
} catch (Exception e) {
log.error("error init sched", e);
}
}
开发者ID:xiangtao,项目名称:timeschedule,代码行数:28,代码来源:QuartzScheduleWrapper.java
示例2: start
import org.quartz.impl.DirectSchedulerFactory; //导入依赖的package包/类
@Override
public void start() throws Exception {
if (!started) {
System.setProperty("org.terracotta.quartz.skipUpdateCheck", "true");
DirectSchedulerFactory factory = DirectSchedulerFactory.getInstance();
SimpleThreadPool threadPool = new SimpleThreadPool(this.numThreads,
Thread.NORM_PRIORITY);
threadPool.setThreadNamePrefix("scheduling-worker");
threadPool.initialize();
final String schedulerName = DEFAULT_SCHEDULER_NAME + ":" + this.name;
factory.createScheduler(schedulerName,
DEFAULT_INSTANCE_ID + ":" + this.name,
threadPool, new RAMJobStore());
this.scheduler = factory.getScheduler(schedulerName);
this.scheduler.getListenerManager().addTriggerListener(new TriggerListener());
this.scheduler.start();
started = true;
log.info("Quartz started");
}
}
开发者ID:projectodd,项目名称:wunderboss,代码行数:23,代码来源:QuartzScheduling.java
示例3: start
import org.quartz.impl.DirectSchedulerFactory; //导入依赖的package包/类
public void start() throws SearchLibException {
if (ClientFactory.INSTANCE.properties.isDisableScheduler())
Logging.warn("The scheduler is disabled ");
rwl.w.lock();
try {
if (scheduler == null) {
if (schedulerFactory == null)
schedulerFactory = DirectSchedulerFactory.getInstance();
threadPoolSize = ClientFactory.INSTANCE.getSchedulerThreadPoolSize().getValue();
schedulerFactory.createVolatileScheduler(threadPoolSize);
scheduler = schedulerFactory.getScheduler();
}
scheduler.start();
} catch (SchedulerException e) {
throw new SearchLibException(e);
} finally {
rwl.w.unlock();
}
}
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:20,代码来源:TaskManager.java
示例4: createScheduler
import org.quartz.impl.DirectSchedulerFactory; //导入依赖的package包/类
/**
* Create a new {@link Scheduler} and set to stand-by mode.
*/
private Scheduler createScheduler() throws SchedulerException {
// ensure executed threads have TCCL set
ThreadExecutor threadExecutor = new DefaultThreadExecutor()
{
@Override
public void execute(final Thread thread) {
thread.setContextClassLoader(QuartzSchedulerSPI.class.getClassLoader());
super.execute(thread);
}
};
// create Scheduler (implicitly registers it with repository)
DirectSchedulerFactory.getInstance().createScheduler(
SCHEDULER_NAME,
nodeAccess.getId(), // instance-id
new QuartzThreadPool(threadPoolSize),
threadExecutor,
jobStoreProvider.get(),
null, // scheduler plugin-map
null, // rmi-registry host
0, // rmi-registry port
-1, // idle-wait time
-1, // db-failure retry-interval
true, // jmx-export
null, // custom jmx object-name, lets use the default
1, // max batch-size
0L // batch time-window
);
Scheduler scheduler = DirectSchedulerFactory.getInstance().getScheduler(SCHEDULER_NAME);
scheduler.setJobFactory(jobFactory);
// re-logging with version, as by default we limit quartz logging to WARN, hiding its default version logging
log.info("Quartz Scheduler v{}", scheduler.getMetaData().getVersion());
scheduler.standby();
return scheduler;
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:42,代码来源:QuartzSchedulerSPI.java
示例5: setUp
import org.quartz.impl.DirectSchedulerFactory; //导入依赖的package包/类
@Before
public void setUp() throws SchedulerException {
DirectSchedulerFactory schedulerFactory = DirectSchedulerFactory.getInstance();
schedulerFactory.createVolatileScheduler(1);
scheduler = schedulerFactory.getScheduler();
scheduler.start();
Assert.assertNotNull(scheduler);
manager = new ScheduledInvocationManagerImpl();
manager.setIdManager(() -> UUID.randomUUID().toString());
manager.setSchedulerFactory(schedulerFactory);
manager.setDao(dao);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:ScheduledInvocationTest.java
注:本文中的org.quartz.impl.DirectSchedulerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论