Class TimerSchedulerImpl<T>
- java.lang.Object
-
- akka.actor.typed.internal.TimerSchedulerImpl<T>
-
- All Implemented Interfaces:
TimerScheduler<T>
,TimerScheduler<T>
public class TimerSchedulerImpl<T> extends java.lang.Object implements TimerScheduler<T>, TimerScheduler<T>
INTERNAL API
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TimerSchedulerImpl.Timer<T>
static class
TimerSchedulerImpl.Timer$
static class
TimerSchedulerImpl.TimerMsg
-
Constructor Summary
Constructors Constructor Description TimerSchedulerImpl(ActorContext<T> ctx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel(java.lang.Object key)
Cancel a timer with a givenkey
.void
cancelAll()
Cancel all timers.OptionVal<T>
interceptTimerMsg(Logger log, TimerSchedulerImpl.TimerMsg timerMsg)
boolean
isTimerActive(java.lang.Object key)
Check if a timer with a givenkey
is active.void
startPeriodicTimer(java.lang.Object key, T msg, java.time.Duration interval)
Start a periodic timer that will sendmsg
to theself
actor at a fixedinterval
.void
startPeriodicTimer(java.lang.Object key, T msg, scala.concurrent.duration.FiniteDuration interval)
Start a periodic timer that will sendmsg
to theself
actor at a fixedinterval
.void
startSingleTimer(java.lang.Object key, T msg, java.time.Duration delay)
* Start a timer that will sendmsg
once to theself
actor after the givendelay
.void
startSingleTimer(java.lang.Object key, T msg, scala.concurrent.duration.FiniteDuration delay)
Start a timer that will sendmsg
once to theself
actor after the givendelay
.static <T> Behavior<T>
withTimers(scala.Function1<TimerSchedulerImpl<T>,Behavior<T>> factory)
static <T> Behavior<T>
wrapWithTimers(scala.Function1<TimerSchedulerImpl<T>,Behavior<T>> factory, ActorContext<T> ctx)
-
-
-
Constructor Detail
-
TimerSchedulerImpl
public TimerSchedulerImpl(ActorContext<T> ctx)
-
-
Method Detail
-
withTimers
public static <T> Behavior<T> withTimers(scala.Function1<TimerSchedulerImpl<T>,Behavior<T>> factory)
-
wrapWithTimers
public static <T> Behavior<T> wrapWithTimers(scala.Function1<TimerSchedulerImpl<T>,Behavior<T>> factory, ActorContext<T> ctx)
-
startPeriodicTimer
public void startPeriodicTimer(java.lang.Object key, T msg, scala.concurrent.duration.FiniteDuration interval)
Description copied from interface:TimerScheduler
Start a periodic timer that will sendmsg
to theself
actor at a fixedinterval
.Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
- Specified by:
startPeriodicTimer
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)msg
- (undocumented)interval
- (undocumented)
-
startPeriodicTimer
public void startPeriodicTimer(java.lang.Object key, T msg, java.time.Duration interval)
Description copied from interface:TimerScheduler
Start a periodic timer that will sendmsg
to theself
actor at a fixedinterval
.Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
- Specified by:
startPeriodicTimer
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)msg
- (undocumented)interval
- (undocumented)
-
startSingleTimer
public void startSingleTimer(java.lang.Object key, T msg, scala.concurrent.duration.FiniteDuration delay)
Description copied from interface:TimerScheduler
Start a timer that will sendmsg
once to theself
actor after the givendelay
.Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
- Specified by:
startSingleTimer
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)msg
- (undocumented)delay
- (undocumented)
-
startSingleTimer
public void startSingleTimer(java.lang.Object key, T msg, java.time.Duration delay)
Description copied from interface:TimerScheduler
* Start a timer that will sendmsg
once to theself
actor after the givendelay
.Each timer has a key and if a new timer with same key is started the previous is cancelled and it's guaranteed that a message from the previous timer is not received, even though it might already be enqueued in the mailbox when the new timer is started.
- Specified by:
startSingleTimer
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)msg
- (undocumented)delay
- (undocumented)
-
isTimerActive
public boolean isTimerActive(java.lang.Object key)
Description copied from interface:TimerScheduler
Check if a timer with a givenkey
is active.- Specified by:
isTimerActive
in interfaceTimerScheduler<T>
- Specified by:
isTimerActive
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)- Returns:
- (undocumented)
-
cancel
public void cancel(java.lang.Object key)
Description copied from interface:TimerScheduler
Cancel a timer with a givenkey
. If canceling a timer that was already canceled, or key never was used to start a timer this operation will do nothing.It is guaranteed that a message from a canceled timer, including its previous incarnation for the same key, will not be received by the actor, even though the message might already be enqueued in the mailbox when cancel is called.
- Specified by:
cancel
in interfaceTimerScheduler<T>
- Specified by:
cancel
in interfaceTimerScheduler<T>
- Parameters:
key
- (undocumented)
-
cancelAll
public void cancelAll()
Description copied from interface:TimerScheduler
Cancel all timers.- Specified by:
cancelAll
in interfaceTimerScheduler<T>
- Specified by:
cancelAll
in interfaceTimerScheduler<T>
-
interceptTimerMsg
public OptionVal<T> interceptTimerMsg(Logger log, TimerSchedulerImpl.TimerMsg timerMsg)
-
-