Search in sources :

Example 6 with Cancellable

use of akka.actor.Cancellable in project flink by apache.

the class ActorSystemScheduledExecutorAdapter method schedule.

@Override
@Nonnull
public ScheduledFuture<?> schedule(@Nonnull Runnable command, long delay, @Nonnull TimeUnit unit) {
    ScheduledFutureTask<Void> scheduledFutureTask = new ScheduledFutureTask<>(command, unit.toNanos(delay), 0L);
    Cancellable cancellable = internalSchedule(scheduledFutureTask, delay, unit);
    scheduledFutureTask.setCancellable(cancellable);
    return scheduledFutureTask;
}
Also used : Cancellable(akka.actor.Cancellable) Nonnull(javax.annotation.Nonnull)

Example 7 with Cancellable

use of akka.actor.Cancellable in project flink by apache.

the class ActorSystemScheduledExecutorAdapter method scheduleWithFixedDelay.

@Override
@Nonnull
public ScheduledFuture<?> scheduleWithFixedDelay(@Nonnull Runnable command, long initialDelay, long delay, @Nonnull TimeUnit unit) {
    ScheduledFutureTask<Void> scheduledFutureTask = new ScheduledFutureTask<>(command, triggerTime(unit.toNanos(initialDelay)), unit.toNanos(-delay));
    Cancellable cancellable = internalSchedule(scheduledFutureTask, initialDelay, unit);
    scheduledFutureTask.setCancellable(cancellable);
    return scheduledFutureTask;
}
Also used : Cancellable(akka.actor.Cancellable) Nonnull(javax.annotation.Nonnull)

Example 8 with Cancellable

use of akka.actor.Cancellable in project flink by apache.

the class ActorSystemScheduledExecutorAdapter method schedule.

@Override
@Nonnull
public <V> ScheduledFuture<V> schedule(@Nonnull Callable<V> callable, long delay, @Nonnull TimeUnit unit) {
    ScheduledFutureTask<V> scheduledFutureTask = new ScheduledFutureTask<>(callable, unit.toNanos(delay), 0L);
    Cancellable cancellable = internalSchedule(scheduledFutureTask, delay, unit);
    scheduledFutureTask.setCancellable(cancellable);
    return scheduledFutureTask;
}
Also used : Cancellable(akka.actor.Cancellable) Nonnull(javax.annotation.Nonnull)

Aggregations

Cancellable (akka.actor.Cancellable)8 Nonnull (javax.annotation.Nonnull)4 FiniteDuration (scala.concurrent.duration.FiniteDuration)2 ActorRef (akka.actor.ActorRef)1 Scheduler (akka.actor.Scheduler)1 SelectOwner (org.opendaylight.controller.cluster.datastore.entityownership.messages.SelectOwner)1 ExecutionContextExecutor (scala.concurrent.ExecutionContextExecutor)1