|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public static interface Creators.Act
This trait provides a DSL for writing the inner workings of an actor, e.g. for quickly trying things out in the REPL. It makes the following keywords available:
- 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface akka.actor.Actor |
|---|
Actor.emptyBehavior$ |
| Method Summary | |
|---|---|
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. |
| Methods inherited from interface akka.actor.Actor |
|---|
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, context, self, sender, unhandled |
| Method Detail |
|---|
OneForOneStrategy$ OneForOneStrategy()
OneForOneStrategyAllForOneStrategy$ AllForOneStrategy()
AllForOneStrategySupervisorStrategy.Stop$ Stop()
SupervisorStrategySupervisorStrategy.Restart$ Restart()
SupervisorStrategySupervisorStrategy.Resume$ Resume()
SupervisorStrategySupervisorStrategy.Escalate$ Escalate()
SupervisorStrategyvoid 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
preStart in interface Actor
void preRestart(java.lang.Throwable cause,
scala.Option<java.lang.Object> msg)
ActorpostStop().'''
preRestart in interface Actorcause - 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)
ActorpreStart().
postRestart in interface Actorcause - 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
postStop in interface ActorSupervisorStrategy supervisorStrategy()
Actor
supervisorStrategy in interface Actorscala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
become to change this.
receive in interface Actor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||