public class StubbedActorContext<T> extends java.lang.Object implements ActorContext<T>
ActorContext
for synchronous execution of a Behavior
that
provides only stubs for the effects an Actor can perform and replaces
created child Actors by a synchronous Inbox (see Inbox.sync
).
See EffectfulActorContext
for more advanced uses.
Constructor and Description |
---|
StubbedActorContext(java.lang.String name,
Props<T> props,
ActorSystem<scala.runtime.Nothing$> system) |
Modifier and Type | Method and Description |
---|---|
akka.actor.ActorRef |
actorOf(akka.actor.Props props)
Create an untyped child Actor from the given
Props under a randomly chosen name. |
akka.actor.ActorRef |
actorOf(akka.actor.Props props,
java.lang.String name)
Create an untyped child Actor from the given
Props and with the given name. |
scala.Option<ActorRef<scala.runtime.Nothing$>> |
child(java.lang.String name)
The named child Actor if it is alive.
|
scala.collection.Iterable<ActorRef<scala.runtime.Nothing$>> |
children()
The list of child Actors created by this Actor during its lifetime that
are still alive, in no particular order.
|
scala.concurrent.ExecutionContextExecutor |
executionContext()
This Actor’s execution context.
|
<U> Inbox.SyncInbox<U> |
getInbox(java.lang.String name) |
Inbox.SyncInbox<T> |
inbox() |
java.lang.String |
name() |
Props<T> |
props()
The
Props from which this Actor was created. |
void |
removeInbox(java.lang.String name) |
<U> akka.actor.Cancellable |
schedule(scala.concurrent.duration.FiniteDuration delay,
ActorRef<U> target,
U msg)
Schedule the sending of the given message to the given target Actor after
the given time period has elapsed.
|
ActorRef<T> |
self()
The identity of this Actor, bound to the lifecycle of this Actor instance.
|
void |
setReceiveTimeout(scala.concurrent.duration.Duration d)
Schedule the sending of a
ReceiveTimeout notification in case no other
message is received during the given period of time. |
<U> ActorRef<U> |
spawn(Props<U> props,
java.lang.String name)
Create a child Actor from the given
Props and with the given name. |
<U> ActorRef<U> |
spawnAdapter(scala.Function1<U,T> f)
Create a child actor that will wrap messages such that other Actor’s
protocols can be ingested by this Actor.
|
<U> ActorRef<U> |
spawnAnonymous(Props<U> props)
Create a child Actor from the given
Props under a randomly chosen name. |
boolean |
stop(ActorRef<scala.runtime.Nothing$> child)
Force the child Actor under the given name to terminate after it finishes
processing its current message.
|
ActorSystem<scala.runtime.Nothing$> |
system()
The
ActorSystem to which this Actor belongs. |
akka.actor.ActorRef |
unwatch(akka.actor.ActorRef other)
Revoke the registration established by
watch . |
<U> ActorRef<U> |
unwatch(ActorRef<U> other)
Revoke the registration established by
watch . |
akka.actor.ActorRef |
watch(akka.actor.ActorRef other)
Register for
Terminated notification once the Actor identified by the
given ActorRef terminates. |
<U> ActorRef<U> |
watch(ActorRef<U> other)
Register for
Terminated notification once the Actor identified by the
given ActorRef terminates. |
public StubbedActorContext(java.lang.String name, Props<T> props, ActorSystem<scala.runtime.Nothing$> system)
public java.lang.String name()
public Props<T> props()
ActorContext
Props
from which this Actor was created.props
in interface ActorContext<T>
public ActorSystem<scala.runtime.Nothing$> system()
ActorContext
ActorSystem
to which this Actor belongs.system
in interface ActorContext<T>
public Inbox.SyncInbox<T> inbox()
public ActorRef<T> self()
ActorContext
ActorRef
.self
in interface ActorContext<T>
public scala.collection.Iterable<ActorRef<scala.runtime.Nothing$>> children()
ActorContext
children
in interface ActorContext<T>
public scala.Option<ActorRef<scala.runtime.Nothing$>> child(java.lang.String name)
ActorContext
child
in interface ActorContext<T>
name
- (undocumented)public <U> ActorRef<U> spawnAnonymous(Props<U> props)
ActorContext
Props
under a randomly chosen name.
It is good practice to name Actors wherever practical.spawnAnonymous
in interface ActorContext<T>
props
- (undocumented)public <U> ActorRef<U> spawn(Props<U> props, java.lang.String name)
ActorContext
Props
and with the given name.spawn
in interface ActorContext<T>
props
- (undocumented)name
- (undocumented)public akka.actor.ActorRef actorOf(akka.actor.Props props)
ActorContext
Props
under a randomly chosen name.
It is good practice to name Actors wherever practical.actorOf
in interface ActorContext<T>
props
- (undocumented)public akka.actor.ActorRef actorOf(akka.actor.Props props, java.lang.String name)
ActorContext
Props
and with the given name.actorOf
in interface ActorContext<T>
props
- (undocumented)name
- (undocumented)public boolean stop(ActorRef<scala.runtime.Nothing$> child)
ActorContext
stop
in interface ActorContext<T>
child
- (undocumented)ActorRef
points to a current child Actorpublic <U> ActorRef<U> watch(ActorRef<U> other)
ActorContext
Terminated
notification once the Actor identified by the
given ActorRef
terminates. This notification is also generated when the
ActorSystem
to which the referenced Actor belongs is declared as
failed (e.g. in reaction to being unreachable).watch
in interface ActorContext<T>
other
- (undocumented)public akka.actor.ActorRef watch(akka.actor.ActorRef other)
ActorContext
Terminated
notification once the Actor identified by the
given ActorRef
terminates. This notification is also generated when the
ActorSystem
to which the referenced Actor belongs is declared as
failed (e.g. in reaction to being unreachable).watch
in interface ActorContext<T>
other
- (undocumented)public <U> ActorRef<U> unwatch(ActorRef<U> other)
ActorContext
watch
. A Terminated
notification will not subsequently be received for the referenced Actor.unwatch
in interface ActorContext<T>
other
- (undocumented)public akka.actor.ActorRef unwatch(akka.actor.ActorRef other)
ActorContext
watch
. A Terminated
notification will not subsequently be received for the referenced Actor.unwatch
in interface ActorContext<T>
other
- (undocumented)public void setReceiveTimeout(scala.concurrent.duration.Duration d)
ActorContext
ReceiveTimeout
notification in case no other
message is received during the given period of time. The timeout starts anew
with each received message. Provide Duration.Undefined
to switch off this
mechanism.setReceiveTimeout
in interface ActorContext<T>
d
- (undocumented)public <U> akka.actor.Cancellable schedule(scala.concurrent.duration.FiniteDuration delay, ActorRef<U> target, U msg)
ActorContext
Cancellable
cancel
on the returned
handle.schedule
in interface ActorContext<T>
delay
- (undocumented)target
- (undocumented)msg
- (undocumented)public scala.concurrent.ExecutionContextExecutor executionContext()
ActorContext
Future
combinators.executionContext
in interface ActorContext<T>
public <U> ActorRef<U> spawnAdapter(scala.Function1<U,T> f)
ActorContext
spawnAdapter
in interface ActorContext<T>
f
- (undocumented)public <U> Inbox.SyncInbox<U> getInbox(java.lang.String name)
public void removeInbox(java.lang.String name)