本文整理了Java中akka.actor.Scheduler.scheduleOnce()
方法的一些代码示例,展示了Scheduler.scheduleOnce()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.scheduleOnce()
方法的具体详情如下:
包路径:akka.actor.Scheduler
类名称:Scheduler
方法名:scheduleOnce
暂无
代码示例来源:origin: kaaproject/kaa
private void scheduleTimeoutMessage(ActorContext context, TimeoutMessage message, long delay) {
context.system()
.scheduler()
.scheduleOnce(
Duration.create(delay, TimeUnit.MILLISECONDS), context.self(), message,
context.dispatcher(), context.self());
}
代码示例来源:origin: kaaproject/kaa
private void applyRedirectionRule(RedirectionRule body) {
context()
.system()
.scheduler()
.scheduleOnce(Duration.create(body.ruleTTL, TimeUnit.MILLISECONDS), self(),
new RuleTimeoutMessage(body.getRuleId()),
context().dispatcher(), self());
redirectionRules.put(body.getRuleId(), body);
}
代码示例来源:origin: kaaproject/kaa
void scheduleTimeoutMessage(ActorContext context, EndpointEvent event) {
context.system()
.scheduler()
.scheduleOnce(Duration.create(getTtl(event), TimeUnit.MILLISECONDS), context.self(),
new EndpointEventTimeoutMessage(event), context.dispatcher(), context.self());
}
代码示例来源:origin: eBay/parallec
/**
* Wait and retry.
*/
public void waitAndRetry() {
ContinueToSendToBatchSenderAsstManager continueToSendToBatchSenderAsstManager = new ContinueToSendToBatchSenderAsstManager(
processedWorkerCount);
logger.debug("NOW WAIT Another " + asstManagerRetryIntervalMillis
+ " MS. at " + PcDateUtils.getNowDateTimeStrStandard());
getContext()
.system()
.scheduler()
.scheduleOnce(
Duration.create(asstManagerRetryIntervalMillis,
TimeUnit.MILLISECONDS), getSelf(),
continueToSendToBatchSenderAsstManager,
getContext().system().dispatcher(), getSelf());
return;
}
代码示例来源:origin: eBay/parallec
/**
*
* 201412: now consider the poller. With poller, will cancel this future
* task and reschedule
*/
private void cancelExistingIfAnyAndScheduleTimeoutCall() {
// To handle cases where this operation takes extremely long, schedule a
// 'timeout' message to be sent to us
if (timeoutMessageCancellable != null
&& !timeoutMessageCancellable.isCancelled()) {
timeoutMessageCancellable.cancel();
}
// now reschedule
timeoutMessageCancellable = getContext()
.system()
.scheduler()
.scheduleOnce(timeoutDuration, getSelf(),
OperationWorkerMsgType.OPERATION_TIMEOUT,
getContext().system().dispatcher(), getSelf());
}
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(timeOutDuration, getSelf(),
ExecutionManagerMsgType.OPERATION_TIMEOUT,
getContext().system().dispatcher(), getSelf());
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
timeoutDuration,
getSelf(),
.system()
.scheduler()
.scheduleOnce(
(FiniteDuration) Duration.create(0.5,
TimeUnit.SECONDS),
.system()
.scheduler()
.scheduleOnce(
(FiniteDuration) Duration.create(
ParallecGlobalConfig.sshFutureCheckIntervalSec,
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
timeoutDuration,
getSelf(),
.system()
.scheduler()
.scheduleOnce(
(FiniteDuration) Duration.create(0.5,
TimeUnit.SECONDS),
.system()
.scheduler()
.scheduleOnce(
(FiniteDuration) Duration.create(
ParallecGlobalConfig.pingFutureCheckIntervalSec,
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
Duration.create(httpPollerProcessor
.getPollIntervalMillis(),
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
timeoutDuration,
getSelf(),
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
timeoutDuration,
getSelf(),
代码示例来源:origin: eBay/parallec
.system()
.scheduler()
.scheduleOnce(
timeoutDuration,
getSelf(),
代码示例来源:origin: opendaylight/controller
public <T extends BackendInfo> Cancellable executeInActor(@Nonnull final InternalCommand<T> command,
final FiniteDuration delay) {
return scheduler.scheduleOnce(Preconditions.checkNotNull(delay), self(), Preconditions.checkNotNull(command),
executionContext, ActorRef.noSender());
}
}
代码示例来源:origin: eclipse/ditto
private Cancellable scheduleOnce(final FiniteDuration when, final Object message, final ActorRef sender) {
return persistenceActor.context()
.system()
.scheduler()
.scheduleOnce(when, persistenceActor.self(), message, persistenceActor.context().dispatcher(),
sender);
}
代码示例来源:origin: eclipse/ditto
private void schedulePendingResponse(final ConnectivityCommandResponse response, final ActorRef sender) {
getContext().system().scheduler()
.scheduleOnce(flushPendingResponsesTimeout,
sender,
response,
getContext().dispatcher(),
getSelf());
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-things-persistence
@Override
public void doApply(final Terminated message) {
log.info("Persistence actor for Thing with ID <{}> terminated abnormally.", thingId);
child = null;
final Duration restartDelay = calculateRestartDelay();
getContext().system()
.scheduler()
.scheduleOnce(new FiniteDuration(restartDelay.toNanos(), TimeUnit.NANOSECONDS), getSelf(),
StartChild.INSTANCE, getContext().dispatcher(), null);
restartCount += 1;
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-policies-persistence
private void scheduleSnapshot(final long intervalInSeconds) {
// send a message to ourselft:
snapshotter = getContext().system().scheduler()
.scheduleOnce(Duration.apply(intervalInSeconds, TimeUnit.SECONDS), getSelf(),
TakeSnapshotInternal.INSTANCE,
getContext().dispatcher(), null);
}
代码示例来源:origin: org.eclipse.ditto/ditto-services-amqpbridge-messaging
private void scheduleShutdown() {
shutdownCancellable = getContext().getSystem().scheduler()
.scheduleOnce(SHUTDOWN_DELAY,
getSelf(),
Shutdown.getInstance(),
getContext().dispatcher(),
ActorRef.noSender());
}
代码示例来源:origin: eclipse/ditto
private void stopSelfIfDeletedAfterDelay() {
final ExecutionContextExecutor dispatcher = getContext().dispatcher();
cancelStopSelfIfDeletedTrigger();
stopSelfIfDeletedTrigger = getContext().system()
.scheduler()
.scheduleOnce(DELETED_ACTOR_LIFETIME, getSelf(), STOP_SELF_IF_DELETED, dispatcher, ActorRef.noSender());
}
代码示例来源:origin: eclipse/ditto
private void scheduleCheckForPolicyActivity(final long intervalInSeconds) {
if (activityChecker != null) {
activityChecker.cancel();
}
// send a message to ourselves:
activityChecker = getContext().system().scheduler()
.scheduleOnce(Duration.apply(intervalInSeconds, TimeUnit.SECONDS), getSelf(),
new CheckForActivity(lastSequenceNr(), accessCounter), getContext().dispatcher(), null);
}
内容来源于网络,如有侵权,请联系作者删除!