本文整理汇总了Java中org.springframework.scheduling.support.PeriodicTrigger类的典型用法代码示例。如果您正苦于以下问题:Java PeriodicTrigger类的具体用法?Java PeriodicTrigger怎么用?Java PeriodicTrigger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PeriodicTrigger类属于org.springframework.scheduling.support包,在下文中一共展示了PeriodicTrigger类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: periodicTrigger
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean(name = TriggerConstants.TRIGGER_BEAN_NAME)
@Conditional(PeriodicTriggerCondition.class)
public Trigger periodicTrigger() {
PeriodicTrigger trigger = new PeriodicTrigger(triggerProperties.getFixedDelay(),
triggerProperties.getTimeUnit());
trigger.setInitialDelay(triggerProperties.getInitialDelay());
return trigger;
}
示例2: defaultStreamSpanReporterPoller
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean(name = StreamSpanReporter.POLLER)
@ConditionalOnMissingBean(name = StreamSpanReporter.POLLER)
public PollerMetadata defaultStreamSpanReporterPoller(SleuthStreamProperties sleuth) {
PollerMetadata poller = new PollerMetadata();
poller.setTrigger(new PeriodicTrigger(sleuth.getPoller().getFixedDelay()));
poller.setMaxMessagesPerPoll(sleuth.getPoller().getMaxMessagesPerPoll());
return poller;
}
示例3: assertPollerConfiguration
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
private void assertPollerConfiguration(PollerMetadata poller,
long expectedMaxMessages, long expectedFixedDelay) {
assertThat(poller.getMaxMessagesPerPoll()).isEqualTo(expectedMaxMessages);
Trigger trigger = poller.getTrigger();
assertThat(trigger).isInstanceOf(PeriodicTrigger.class);
TriggerContext triggerContext = new SimpleTriggerContext(LAST_SCHEDULED_DATE,
LAST_EXECUTED_DATE, LAST_COMPLETED_DATE);
Date nextExecution = trigger.nextExecutionTime(triggerContext);
assertThat(nextExecution.getTime())
.isEqualTo(LAST_COMPLETED_DATE.getTime() + expectedFixedDelay);
}
示例4: customPoller
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean(name = StreamSpanReporter.POLLER)
PollerMetadata customPoller() {
PollerMetadata poller = new PollerMetadata();
poller.setMaxMessagesPerPoll(500);
poller.setTrigger(new PeriodicTrigger(5000L));
return poller;
}
示例5: xmlFilePoller
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean
public PollerMetadata xmlFilePoller() {
PollerMetadata poller = new PollerMetadata();
poller.setMaxMessagesPerPoll(config.getXmlFilesPerPoll());
PeriodicTrigger trigger = new PeriodicTrigger(config.getXmlFilesPollInterval());
trigger.setFixedRate(false);
poller.setTrigger(trigger);
return poller;
}
示例6: defaultPoller
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean(name = PollerMetadata.DEFAULT_POLLER)
public PollerMetadata defaultPoller() {
PollerMetadata pollerMetadata = new PollerMetadata();
pollerMetadata.setTrigger(new PeriodicTrigger(10));
return pollerMetadata;
}
示例7: createPeriodicTrigger
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
private PeriodicTrigger createPeriodicTrigger(int timeout) {
PeriodicTrigger trigger = new PeriodicTrigger(timeout, TimeUnit.MINUTES);
trigger.setInitialDelay(timeout);
return trigger;
}
示例8: defaultPoller
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
@Bean(name = PollerMetadata.DEFAULT_POLLER)
public PollerMetadata defaultPoller() {
final PollerMetadata pollerMetadata = new PollerMetadata();
pollerMetadata.setTrigger(new PeriodicTrigger(10));
return pollerMetadata;
}
示例9: getPollerMetadata
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
public PollerMetadata getPollerMetadata() {
PollerMetadata pollerMetadata = new PollerMetadata();
pollerMetadata.setTrigger(new PeriodicTrigger(this.fixedDelay));
pollerMetadata.setMaxMessagesPerPoll(this.maxMessagesPerPoll);
return pollerMetadata;
}
示例10: fixedDelay
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
/**
* Create a schedule with fixed delay between job executions.
*
* @param fixedDelayMs Fixed delay in millis
* @param initialDelayMs Initial delay in millis
* @return Schedule
* @since 0.24
* @see ScheduledJobFuture#scheduleWithFixedDelay(long, long)
*/
public static Schedule fixedDelay(long fixedDelayMs, long initialDelayMs) {
PeriodicTrigger pt = new PeriodicTrigger(fixedDelayMs);
pt.setFixedRate(false);
pt.setInitialDelay(initialDelayMs);
return new Schedule(pt, "fixedDelayMs: " + fixedDelayMs);
}
示例11: fixedRate
import org.springframework.scheduling.support.PeriodicTrigger; //导入依赖的package包/类
/**
* Create a schedule with fixed rate of launching job executions.
*
* @param fixedRateMs Fixed rate in millis
* @param initialDelayMs Initial delay in millis
* @return Schedule
* @since 0.24
* @see ScheduledJobFuture#scheduleAtFixedRate(long, long)
*/
public static Schedule fixedRate(long fixedRateMs, long initialDelayMs) {
PeriodicTrigger pt = new PeriodicTrigger(fixedRateMs);
pt.setFixedRate(true);
pt.setInitialDelay(initialDelayMs);
return new Schedule(pt, "fixedRateMs: " + fixedRateMs);
}