public class LightArrayRevolverScheduler extends java.lang.Object implements Scheduler, java.io.Closeable
Also noteworthy is that this scheduler does not obtain a current time stamp when scheduling single-shot tasks, instead it always rounds up the task delay to a full multiple of the TickDuration. This means that tasks are scheduled possibly one tick later than they could be (if checking that “now() + delay <= nextTick” were done).
Modifier and Type | Class and Description |
---|---|
protected static class |
LightArrayRevolverScheduler.TaskHolder
INTERNAL API
|
protected static interface |
LightArrayRevolverScheduler.TimerTask
INTERNAL API
|
Constructor and Description |
---|
LightArrayRevolverScheduler(com.typesafe.config.Config config,
LoggingAdapter log,
java.util.concurrent.ThreadFactory threadFactory) |
Modifier and Type | Method and Description |
---|---|
protected long |
clock()
Clock implementation is replaceable (for testing); the implementation must
return a monotonically increasing series of Long nanoseconds.
|
void |
close() |
protected scala.concurrent.duration.FiniteDuration |
getShutdownTimeout()
Overridable for tests
|
double |
maxFrequency()
The maximum supported task frequency of this scheduler, i.e.
|
Cancellable |
schedule(scala.concurrent.duration.FiniteDuration initialDelay,
scala.concurrent.duration.FiniteDuration delay,
java.lang.Runnable runnable,
scala.concurrent.ExecutionContext executor)
Schedules a
Runnable to be run repeatedly with an initial delay and
a frequency. |
static ActorRef |
schedule$default$6(scala.concurrent.duration.FiniteDuration initialDelay,
scala.concurrent.duration.FiniteDuration interval,
ActorRef receiver,
java.lang.Object message) |
Cancellable |
scheduleOnce(scala.concurrent.duration.FiniteDuration delay,
java.lang.Runnable runnable,
scala.concurrent.ExecutionContext executor)
Schedules a Runnable to be run once with a delay, i.e.
|
static ActorRef |
scheduleOnce$default$5(scala.concurrent.duration.FiniteDuration delay,
ActorRef receiver,
java.lang.Object message) |
scala.concurrent.duration.FiniteDuration |
ShutdownTimeout() |
protected int |
startTick()
Replaceable for testing.
|
scala.concurrent.duration.FiniteDuration |
TickDuration() |
protected void |
waitNanos(long nanos)
Overridable for tests
|
int |
WheelSize() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
schedule, schedule, scheduleOnce, scheduleOnce
public LightArrayRevolverScheduler(com.typesafe.config.Config config, LoggingAdapter log, java.util.concurrent.ThreadFactory threadFactory)
public static final ActorRef schedule$default$6(scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration interval, ActorRef receiver, java.lang.Object message)
public static final ActorRef scheduleOnce$default$5(scala.concurrent.duration.FiniteDuration delay, ActorRef receiver, java.lang.Object message)
public int WheelSize()
public scala.concurrent.duration.FiniteDuration TickDuration()
public scala.concurrent.duration.FiniteDuration ShutdownTimeout()
protected long clock()
protected int startTick()
protected scala.concurrent.duration.FiniteDuration getShutdownTimeout()
protected void waitNanos(long nanos)
nanos
- (undocumented)public Cancellable schedule(scala.concurrent.duration.FiniteDuration initialDelay, scala.concurrent.duration.FiniteDuration delay, java.lang.Runnable runnable, scala.concurrent.ExecutionContext executor)
Scheduler
Runnable
to be run repeatedly with an initial delay and
a frequency. E.g. if you would like the function to be run after 2
seconds and thereafter every 100ms you would set delay = Duration(2,
TimeUnit.SECONDS) and interval = Duration(100, TimeUnit.MILLISECONDS). If
the execution of the runnable takes longer than the interval, the
subsequent execution will start immediately after the prior one completes
(there will be no overlap of executions of the runnable). In such cases,
the actual execution interval will differ from the interval passed to this
method.
If the Runnable
throws an exception the repeated scheduling is aborted,
i.e. the function will not be invoked any more.
Java API
public Cancellable scheduleOnce(scala.concurrent.duration.FiniteDuration delay, java.lang.Runnable runnable, scala.concurrent.ExecutionContext executor)
Scheduler
Java & Scala API
scheduleOnce
in interface Scheduler
delay
- (undocumented)runnable
- (undocumented)executor
- (undocumented)public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public double maxFrequency()
Scheduler
maxFrequency
in interface Scheduler