本文整理汇总了Java中org.quartz.spi.SchedulerSignaler类的典型用法代码示例。如果您正苦于以下问题:Java SchedulerSignaler类的具体用法?Java SchedulerSignaler怎么用?Java SchedulerSignaler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchedulerSignaler类属于org.quartz.spi包,在下文中一共展示了SchedulerSignaler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) throws SchedulerConfigException {
init();
realJobStore.setInstanceId(schedInstId);
realJobStore.setInstanceName(schedName);
realJobStore.setTcRetryInterval(tcRetryInterval);
if (misFireThreshold != null) {
realJobStore.setMisfireThreshold(misFireThreshold);
}
if (synchWrite != null) {
realJobStore.setSynchronousWrite(synchWrite);
}
if (estimatedTimeToReleaseAndAcquireTrigger != null) {
realJobStore.setEstimatedTimeToReleaseAndAcquireTrigger(estimatedTimeToReleaseAndAcquireTrigger);
}
realJobStore.initialize(loadHelper, signaler);
}
示例2: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
/**
* <p>
* Called by the QuartzScheduler before the <code>JobStore</code> is used, in order to give the it a chance to
* initialize.
* </p>
*/
@Override
// XXX: remove this suppression
@SuppressWarnings("unchecked")
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler schedulerSignaler) {
this.terracottaClientId = clusterInfo.getCurrentNode().getId();
this.ftrCtr = System.currentTimeMillis();
// this MUST happen before initializing the trigger set (otherwise we might receive an update which get an NPE)
// this.serializer.setClassLoadHelper(loadHelper);
this.signaler = schedulerSignaler;
getLog().info(getClass().getSimpleName() + " initialized.");
((ToolkitInternal) toolkit).registerBeforeShutdownHook(new ShutdownHook(this));
}
示例3: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public synchronized void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException {
if (clusteredJobStore != null) { throw new IllegalStateException("already initialized"); }
clusteredJobStore = createNewJobStoreInstance(schedName, Boolean.valueOf(synchWrite));
clusteredJobStore.setThreadPoolSize(threadPoolSize);
// apply deferred misfire threshold if present
if (misfireThreshold != null) {
clusteredJobStore.setMisfireThreshold(misfireThreshold);
misfireThreshold = null;
}
if (estimatedTimeToReleaseAndAcquireTrigger != null) {
clusteredJobStore.setEstimatedTimeToReleaseAndAcquireTrigger(estimatedTimeToReleaseAndAcquireTrigger);
estimatedTimeToReleaseAndAcquireTrigger = null;
}
clusteredJobStore.setInstanceId(schedInstanceId);
clusteredJobStore.setTcRetryInterval(tcRetryInterval);
clusteredJobStore.initialize(loadHelper, signaler);
// update check
scheduleUpdateCheck();
}
示例4: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@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.");
}
示例5: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
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.");
}
示例6: testStoreAndRetrieveJobs
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Test
public void testStoreAndRetrieveJobs()
throws Exception {
final int nJobs = 10;
SchedulerSignaler schedSignaler = new SampleSignaler();
ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
loadHelper.initialize();
JobStore store = createJobStore("testStoreAndRetrieveJobs");
store.initialize(loadHelper, schedSignaler);
// Store jobs.
for (int i = 0; i < nJobs; i++) {
JobDetail job = JobBuilder.newJob(NoOpJob.class).withIdentity("job" + i).build();
store.storeJob(job, false);
}
// Retrieve jobs.
for (int i = 0; i < nJobs; i++) {
JobKey jobKey = JobKey.jobKey("job" + i);
JobDetail storedJob = store.retrieveJob(jobKey);
Assert.assertEquals(storedJob.getKey(), jobKey);
}
}
示例7: getTriggerState
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Test
public void getTriggerState() throws Exception {
SchedulerSignaler signaler = mock(SchedulerSignaler.class);
AbstractRedisStorage storageDriver = new RedisStorage(new RedisJobStoreSchema(), new ObjectMapper(), signaler, "scheduler1", 2000);
// attempt to retrieve the state of a non-existent trigger
Trigger.TriggerState state = jobStore.getTriggerState(new TriggerKey("foobar"));
assertEquals(Trigger.TriggerState.NONE, state);
// store a trigger
JobDetail job = getJobDetail();
CronTriggerImpl cronTrigger = getCronTrigger("trigger1", "group1", job.getKey());
jobStore.storeTrigger(cronTrigger, false);
// the newly-stored trigger's state should be NONE
state = jobStore.getTriggerState(cronTrigger.getKey());
assertEquals(Trigger.TriggerState.NORMAL, state);
// set the trigger's state
storageDriver.setTriggerState(RedisTriggerState.WAITING, 500, schema.triggerHashKey(cronTrigger.getKey()), jedis);
// the trigger's state should now be NORMAL
state = jobStore.getTriggerState(cronTrigger.getKey());
assertEquals(Trigger.TriggerState.NORMAL, state);
}
示例8: setUpRedis
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Before
public void setUpRedis() throws IOException, SchedulerConfigException {
port = getPort();
logger.debug("Attempting to start embedded Redis server on port " + port);
redisServer = RedisServer.builder()
.port(port)
.build();
redisServer.start();
final short database = 1;
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setTestOnBorrow(true);
jedisPool = new JedisPool(jedisPoolConfig, host, port, Protocol.DEFAULT_TIMEOUT, null, database);
jobStore = new RedisJobStore();
jobStore.setHost(host);
jobStore.setLockTimeout(2000);
jobStore.setPort(port);
jobStore.setInstanceId("testJobStore1");
jobStore.setDatabase(database);
mockScheduleSignaler = mock(SchedulerSignaler.class);
jobStore.initialize(null, mockScheduleSignaler);
schema = new RedisJobStoreSchema();
jedis = jedisPool.getResource();
jedis.flushDB();
}
示例9: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper,
SchedulerSignaler signaler) throws SchedulerConfigException {
this.loadHelper = loadHelper;
this.signaler = signaler;
// initializing a connection pool
JedisPoolConfig config = new JedisPoolConfig();
if (password != null)
pool = new JedisPool(config, host, port, Protocol.DEFAULT_TIMEOUT, password);
else
pool = new JedisPool(config, host, port, Protocol.DEFAULT_TIMEOUT);
// initializing a locking connection pool with a longer timeout
if (lockTimeout == 0)
lockTimeout = 10 * 60 * 1000; // 10 Minutes locking timeout
lockPool = new JedisLock(pool.getResource(), "JobLock", lockTimeout);
}
示例10: testStoreAndRetrieveJobs
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Test()
public void testStoreAndRetrieveJobs() throws Exception {
SchedulerSignaler schedSignaler = new SampleSignaler();
ClassLoadHelper loadHelper = new CascadingClassLoadHelper();
loadHelper.initialize();
JobStore store = createJobStore("testStoreAndRetrieveJobs");
store.initialize(loadHelper, schedSignaler);
// Store jobs.
for (int i = 0; i < 10; i++) {
JobDetail job = JobBuilder.newJob(NoOpJob.class).withIdentity("job" + i)
.build();
store.storeJob(job, false);
}
// Retrieve jobs.
for (int i = 0; i < 10; i++) {
JobKey jobKey = JobKey.jobKey("job" + i);
JobDetail storedJob = store.retrieveJob(jobKey);
Assert.assertEquals(jobKey, storedJob.getKey());
}
}
示例11: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler schedulerSignaler) throws SchedulerConfigException {
this.loadHelper = loadHelper;
this.schedulerSignaler = schedulerSignaler;
if (dynamoDbUrl == null) {
throw new SchedulerConfigException("DynamoDB location must be set");
}
log.info(String.format("DynamoDb: location: '%s', table prefix: '%s'", dynamoDbUrl, quartzPrefix));
configureAwsCredentials();
configureClient();
createClient();
ensureTables();
}
示例12: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper classLoadHelper,
SchedulerSignaler schedSignaler) throws SchedulerConfigException {
super.initialize(classLoadHelper, schedSignaler);
getLog().info("JobStoreTX initialized.");
}
示例13: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
/**
* <p>
* Called by the QuartzScheduler before the <code>JobStore</code> is
* used, in order to give the it a chance to initialize.
* </p>
*/
public void initialize(ClassLoadHelper loadHelper,
SchedulerSignaler signaler) {
this.signaler = signaler;
getLog().info("RAMJobStore initialized.");
}
示例14: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(final ClassLoadHelper loadHelper, final SchedulerSignaler signaler)
throws SchedulerConfigException
{
log.info("Instance name: {}; ID: {}", instanceName, instanceId);
// TODO: Should we consider using ClassLoadHelper?
this.signaler = checkNotNull(signaler);
log.info("Initialized");
}
示例15: initialize
import org.quartz.spi.SchedulerSignaler; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException {
LOG.debug("Initializing Hazelcast Job Store..");
this.schedSignaler = signaler;
if (hazelcastClient == null) {
LOG.warn("Starting new local hazelcast client since not hazelcast instance setted before starting scheduler.");
hazelcastClient = Hazelcast.newHazelcastInstance();
}
// initializing hazelcast maps
LOG.debug("Initializing hazelcast maps...");
jobsByKey = getMap(HC_JOB_STORE_MAP_JOB);
triggersByKey = getMap(HC_JOB_STORE_TRIGGER_BY_KEY_MAP);
jobsByGroup = getMultiMap(HC_JOB_STORE_MAP_JOB_BY_GROUP_MAP);
triggersByGroup = getMultiMap(HC_JOB_STORE_TRIGGER_KEY_BY_GROUP_MAP);
pausedTriggerGroups = getSet(HC_JOB_STORE_PAUSED_TRIGGER_GROUPS);
pausedJobGroups = getSet(HC_JOB_STORE_PAUSED_JOB_GROUPS);
calendarsByName = getMap(HC_JOB_CALENDAR_MAP);
triggersByKey.addIndex("nextFireTime", true);
LOG.debug("Hazelcast Job Store Initialized.");
}