public static interface Creators.Act extends Actor
- become
mapped to context.become(_, discardOld = true)
- becomeStacked
mapped to context.become(_, discardOld = false)
- unbecome
mapped to context.unbecome
- setup
for implementing preStart()
- whenFailing
for implementing preRestart()
- whenRestarted
for implementing postRestart()
- teardown
for implementing postStop
Using the life-cycle keywords multiple times results in replacing the content of the respective hook.
Actor.emptyBehavior$, Actor.ignoringBehavior$
Modifier and Type | Method and Description |
---|---|
AllForOneStrategy$ |
AllForOneStrategy() |
void |
become(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> r)
Replace the behavior at the top of the behavior stack for this actor.
|
void |
becomeStacked(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> r)
Add the given behavior on top of the behavior stack for this actor.
|
SupervisorStrategy.Escalate$ |
Escalate() |
OneForOneStrategy$ |
OneForOneStrategy() |
void |
postRestart(java.lang.Throwable cause)
User overridable callback: By default it calls
preStart() . |
void |
postStop()
User overridable callback.
|
void |
preRestart(java.lang.Throwable cause,
scala.Option<java.lang.Object> msg)
User overridable callback: '''By default it disposes of all children and then calls
postStop() .''' |
void |
preStart()
User overridable callback.
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
Default behavior of the actor is empty, use
become to change this. |
SupervisorStrategy.Restart$ |
Restart() |
SupervisorStrategy.Resume$ |
Resume() |
SupervisorStrategy.Stop$ |
Stop() |
void |
superviseWith(SupervisorStrategy s)
Set the supervisor strategy of this actor, i.e.
|
SupervisorStrategy |
supervisorStrategy()
User overridable definition the strategy to use for supervising
child actors.
|
void |
unbecome()
Pop the active behavior from the behavior stack of this actor.
|
void |
whenFailing(scala.Function2<java.lang.Throwable,scala.Option<java.lang.Object>,scala.runtime.BoxedUnit> body)
Replace the
preRestart action with the supplied function. |
void |
whenRestarted(scala.Function1<java.lang.Throwable,scala.runtime.BoxedUnit> body)
Replace the
postRestart action with the supplied function. |
void |
whenStarting(scala.Function0<scala.runtime.BoxedUnit> body)
Replace the
preStart action with the supplied thunk. |
void |
whenStopping(scala.Function0<scala.runtime.BoxedUnit> body)
Replace the
postStop action with the supplied thunk. |
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, self, sender, unhandled
OneForOneStrategy$ OneForOneStrategy()
OneForOneStrategy
AllForOneStrategy$ AllForOneStrategy()
AllForOneStrategy
SupervisorStrategy.Stop$ Stop()
SupervisorStrategy
SupervisorStrategy.Restart$ Restart()
SupervisorStrategy
SupervisorStrategy.Resume$ Resume()
SupervisorStrategy
SupervisorStrategy.Escalate$ Escalate()
SupervisorStrategy
void becomeStacked(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> r)
unbecome()
to pop an element off
this stack.r
- (undocumented)void become(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> r)
unbecome()
to pop an element off
this stack or becomeStacked()
to push a new element on top of it.r
- (undocumented)void unbecome()
void superviseWith(SupervisorStrategy s)
s
- (undocumented)void whenStarting(scala.Function0<scala.runtime.BoxedUnit> body)
preStart
action with the supplied thunk. Default action
is to call super.preStart()
body
- (undocumented)void whenFailing(scala.Function2<java.lang.Throwable,scala.Option<java.lang.Object>,scala.runtime.BoxedUnit> body)
preRestart
action with the supplied function. Default
action is to call super.preRestart()
, which will kill all children
and invoke postStop()
.body
- (undocumented)void whenRestarted(scala.Function1<java.lang.Throwable,scala.runtime.BoxedUnit> body)
postRestart
action with the supplied function. Default
action is to call super.postRestart
which will call preStart()
.body
- (undocumented)void whenStopping(scala.Function0<scala.runtime.BoxedUnit> body)
postStop
action with the supplied thunk. Default action
is to call super.postStop
.body
- (undocumented)void preStart()
Actor
void preRestart(java.lang.Throwable cause, scala.Option<java.lang.Object> msg)
Actor
postStop()
.'''preRestart
in interface Actor
cause
- the Throwable that caused the restart to happenmsg
- optionally the current message the actor processed when failing, if applicable
Is called on a crashed Actor right BEFORE it is restarted to allow clean
up of resources before Actor is terminated.void postRestart(java.lang.Throwable cause)
Actor
preStart()
.postRestart
in interface Actor
cause
- the Throwable that caused the restart to happen
Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.void postStop()
Actor
SupervisorStrategy supervisorStrategy()
Actor
supervisorStrategy
in interface Actor