本文整理了Java中akka.actor.Scheduler.schedule()
方法的一些代码示例,展示了Scheduler.schedule()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.schedule()
方法的具体详情如下:
包路径:akka.actor.Scheduler
类名称:Scheduler
方法名:schedule
暂无
代码示例来源:origin: apache/usergrid
Cancellable scheduler = getContext().system().scheduler().schedule(
Duration.create( 0, TimeUnit.MILLISECONDS ),
Duration.create( qakkaFig.getQueueRefreshMilliseconds(), TimeUnit.MILLISECONDS ),
Cancellable scheduler = getContext().system().scheduler().schedule(
Duration.create( 0, TimeUnit.SECONDS ),
Duration.create( qakkaFig.getQueueTimeoutSeconds() / 2, TimeUnit.SECONDS ),
Cancellable scheduler = getContext().system().scheduler().schedule(
Duration.create( 0, TimeUnit.MILLISECONDS ),
Duration.create( qakkaFig.getShardAllocationCheckFrequencyMillis(), TimeUnit.MILLISECONDS ),
代码示例来源:origin: com.alibaba.blink/flink-runtime
@Override
@Nonnull
public ScheduledFuture<?> scheduleAtFixedRate(@Nonnull Runnable command, long initialDelay, long period, @Nonnull TimeUnit unit) {
ScheduledFutureTask<Void> scheduledFutureTask = new ScheduledFutureTask<>(
command,
triggerTime(unit.toNanos(initialDelay)),
unit.toNanos(period));
Cancellable cancellable = actorSystem.scheduler().schedule(
new FiniteDuration(initialDelay, unit),
new FiniteDuration(period, unit),
scheduledFutureTask,
actorSystem.dispatcher());
scheduledFutureTask.setCancellable(cancellable);
return scheduledFutureTask;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-thingsearch-updater-actors
@Override
public void preStart() {
final Instant now = Instant.now();
final Duration initialDelay = calculateInitialDelay(now, firstIntervalHour);
log.info("Initial deletion is scheduled at <{}>", now.plus(initialDelay));
scheduler = getContext().getSystem().scheduler()
.schedule(initialDelay, runInterval, getSelf(), PERFORM_DELETION_MESSAGE, getContext().dispatcher(),
getSelf());
}
代码示例来源:origin: srikalyc/Sql4D
/**
* Schedules messages ever interval seconds.
* @param initialDelay
* @param interval
* @param message
* @return
*/
private Cancellable scheduleCron(int initialDelay, int interval, MessageTypes message) {
return scheduler.schedule(secs(initialDelay), secs(interval),
getSelf(), message, getContext().dispatcher(), null);
}
代码示例来源:origin: eclipse/ditto
@Override
public void preStart() {
final Instant now = Instant.now();
final Duration initialDelay = calculateInitialDelay(now, firstIntervalHour);
log.info("Initial deletion is scheduled at <{}>", now.plus(initialDelay));
scheduler = getContext().getSystem().scheduler()
.schedule(initialDelay, runInterval, getSelf(), PERFORM_DELETION_MESSAGE, getContext().dispatcher(),
getSelf());
}
代码示例来源:origin: eclipse/ditto
private Cancellable scheduleReconnect() {
final FiniteDuration initialDelay =
FiniteDuration.apply(reconnectInitialDelay.toMillis(), TimeUnit.MILLISECONDS);
final FiniteDuration interval = FiniteDuration.apply(reconnectInterval.toMillis(), TimeUnit.MILLISECONDS);
final ReconnectMessages message = ReconnectMessages.START_RECONNECT;
log.info("Scheduling reconnect for all connections with initial delay {} and interval {}.",
reconnectInitialDelay, reconnectInterval);
return getContext().getSystem()
.scheduler()
.schedule(initialDelay, interval, getSelf(), message, getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-connectivity-messaging
private Cancellable scheduleReconnect() {
final FiniteDuration initialDelay =
FiniteDuration.apply(reconnectInitialDelay.toMillis(), TimeUnit.MILLISECONDS);
final FiniteDuration interval = FiniteDuration.apply(reconnectInterval.toMillis(), TimeUnit.MILLISECONDS);
final ReconnectMessages message = ReconnectMessages.START_RECONNECT;
log.info("Scheduling reconnect for all connections with initial delay {} and interval {}.",
reconnectInitialDelay, reconnectInterval);
return getContext().getSystem()
.scheduler()
.schedule(initialDelay, interval, getSelf(), message, getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: org.opendaylight.controller/sal-akka-raft-example
private void scheduleRegistrationListener(FiniteDuration interval) {
LOG.debug("--->scheduleRegistrationListener called.");
registrationSchedule = getContext().system().scheduler().schedule(
interval, interval, getSelf(), new RegisterListener(),
getContext().system().dispatcher(), getSelf());
}
代码示例来源:origin: opendaylight/controller
private void scheduleRegistrationListener(FiniteDuration interval) {
LOG.debug("--->scheduleRegistrationListener called.");
registrationSchedule = getContext().system().scheduler().schedule(
interval, interval, getSelf(), new RegisterListener(),
getContext().system().dispatcher(), getSelf());
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-akka
@Override
public void preStart() throws Exception {
super.preStart();
final FiniteDuration delayAndInterval = FiniteDuration.create(getMaxIdleTime().getSeconds(), TimeUnit.SECONDS);
activityCheck = getContext().system().scheduler()
.schedule(delayAndInterval, delayAndInterval, getSelf(), CheckForActivity.INSTANCE,
getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: wxyyxc1992/Backend-Boilerplates
public StatsSampleClient(String servicePath) {
this.servicePath = servicePath;
FiniteDuration interval = Duration.create(2, TimeUnit.SECONDS);
tickTask = getContext()
.system()
.scheduler()
.schedule(interval, interval, self(), "tick",
getContext().dispatcher(), null);
}
代码示例来源:origin: eclipse/ditto
@Override
public void preStart() throws Exception {
super.preStart();
final FiniteDuration delayAndInterval = FiniteDuration.create(getMaxIdleTime().getSeconds(), TimeUnit.SECONDS);
activityCheck = getContext().system().scheduler()
.schedule(delayAndInterval, delayAndInterval, getSelf(), CheckForActivity.INSTANCE,
getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: at.researchstudio.sat/won-matcher-service
@Override
public void preStart() {
// Execute the bulk update at least once a while even if not enough messages are there
getContext().system().scheduler().schedule(
config.getMetaDataUpdateMaxDuration(), config.getMetaDataUpdateMaxDuration(),
getSelf(), TICK, getContext().dispatcher(), null);
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-health
@Override
public void preStart() throws Exception {
super.preStart();
if (enabled) {
final FiniteDuration interval = FiniteDuration.apply(updateInterval.toMillis(), TimeUnit.MILLISECONDS);
checkHealthCancellable = getContext().system().scheduler()
.schedule(interval, interval, getSelf(), CheckHealth.newInstance(),
getContext().dispatcher(),
getSelf());
} else {
log.warning("HealthCheck is DISABLED - not polling for health at all");
}
}
代码示例来源:origin: eclipse/ditto
@Override
public void preStart() throws Exception {
super.preStart();
if (enabled) {
final FiniteDuration interval = FiniteDuration.apply(updateInterval.toMillis(), TimeUnit.MILLISECONDS);
checkHealthCancellable = getContext().system().scheduler()
.schedule(interval, interval, getSelf(), CheckHealth.newInstance(),
getContext().dispatcher(),
getSelf());
} else {
log.warning("HealthCheck is DISABLED - not polling for health at all");
}
}
代码示例来源:origin: eclipse/ditto
private Cancellable scheduleActivityCheck(final StreamConsumerSettings streamConsumerSettings) {
final FiniteDuration initialDelay = fromDuration(streamConsumerSettings.getOutdatedWarningOffset());
final FiniteDuration interval = fromDuration(streamConsumerSettings.getStreamInterval());
final CheckForActivity message = CheckForActivity.INSTANCE;
return getContext().getSystem()
.scheduler()
.schedule(initialDelay, interval, getSelf(), message, getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-utils-akka
private Cancellable scheduleActivityCheck(final StreamConsumerSettings streamConsumerSettings) {
final FiniteDuration initialDelay = fromDuration(streamConsumerSettings.getOutdatedWarningOffset());
final FiniteDuration interval = fromDuration(streamConsumerSettings.getStreamInterval());
final CheckForActivity message = CheckForActivity.INSTANCE;
return getContext().getSystem()
.scheduler()
.schedule(initialDelay, interval, getSelf(), message, getContext().dispatcher(), ActorRef.noSender());
}
代码示例来源:origin: eclipse/ditto
private void scheduleInternalRetrieveHotEntities() {
initHotMetrics();
getContext().getSystem()
.scheduler()
.schedule(FiniteDuration.apply(WAIT_TIME_MS, TimeUnit.MILLISECONDS),
FiniteDuration.apply(SCHEDULE_INTERNAL_RETRIEVE_COMMAND, TimeUnit.MILLISECONDS), getSelf(),
InternalRetrieveStatistics.newInstance(), getContext().getSystem().dispatcher(),
ActorRef.noSender());
}
代码示例来源:origin: keeps/roda
public Master(FiniteDuration workTimeout) {
this.workTimeout = workTimeout;
ClusterClientReceptionist.get(getContext().system()).registerService(getSelf());
this.cleanupTask = getContext().system().scheduler().schedule(workTimeout.div(2), workTimeout.div(2), getSelf(),
CleanupTick, getContext().dispatcher(), getSelf());
}
代码示例来源:origin: keeps/roda
public Worker(ActorRef clusterClient, Props workExecutorProps, FiniteDuration registerInterval) {
this.clusterClient = clusterClient;
this.workExecutor = getContext().watch(getContext().actorOf(workExecutorProps, "exec"));
this.registerTask = getContext().system().scheduler().schedule(Duration.Zero(), registerInterval, clusterClient,
new SendToAll("/user/master/singleton", new RegisterWorker(workerId)), getContext().dispatcher(), getSelf());
}
内容来源于网络,如有侵权,请联系作者删除!