Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
ActorAdapter(Behavior<T> _initialBehavior) |
Modifier and Type | Method and Description |
---|---|
Behavior<T> |
behavior() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
ActorContextAdapter<T> |
ctx() |
scala.collection.immutable.Map<ActorRef,java.lang.Throwable> |
failures() |
void |
postRestart(java.lang.Throwable reason)
User overridable callback: By default it calls
preStart() . |
void |
postStop()
User overridable callback.
|
void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message)
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()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
OneForOneStrategy |
supervisorStrategy()
User overridable definition the strategy to use for supervising
child actors.
|
void |
unhandled(java.lang.Object msg)
User overridable callback.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, sender
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public ActorContextAdapter<T> ctx()
public scala.collection.immutable.Map<ActorRef,java.lang.Throwable> failures()
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public void unhandled(java.lang.Object msg)
Actor
DeathPactException
(in
case of an unhandled Terminated
message) or publishes an UnhandledMessage
to the actor's system's EventStream
public OneForOneStrategy supervisorStrategy()
Actor
supervisorStrategy
in interface Actor
public void preStart()
Actor
public void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
Actor
postStop()
.'''preRestart
in interface Actor
reason
- the Throwable that caused the restart to happenmessage
- 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.public void postRestart(java.lang.Throwable reason)
Actor
preStart()
.postRestart
in interface Actor
reason
- 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.