public class EffectfulActorContext<T> extends StubbedActorContext<T>
ActorContext
for testing purposes that records the effects performed
on it and otherwise stubs them out like a StubbedActorContext
.Constructor and Description |
---|
EffectfulActorContext(java.lang.String _name,
Behavior<T> _initialBehavior,
int _mailboxCapacity,
ActorSystem<scala.runtime.Nothing$> _system) |
Modifier and Type | Method and Description |
---|---|
void |
cancelReceiveTimeout()
Cancel the sending of receive timeout notifications.
|
Behavior<T> |
currentBehavior() |
scala.collection.immutable.Seq<Effect> |
getAllEffects() |
Effect |
getEffect() |
boolean |
hasEffects() |
void |
run(T msg) |
<U> 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.
|
void |
setReceiveTimeout(scala.concurrent.duration.FiniteDuration d,
T msg)
Schedule the sending of a notification in case no other
message is received during the given period of time.
|
void |
signal(Signal signal) |
<U> ActorRef<U> |
spawn(Behavior<U> behavior,
java.lang.String name,
DeploymentConfig deployment)
Create a child Actor from the given
Props and with the given name. |
<U> ActorRef<U> |
spawnAnonymous(Behavior<U> behavior,
DeploymentConfig deployment)
Create a child Actor from the given
Props under a randomly chosen name. |
boolean |
stop(ActorRef<scala.runtime.Nothing$> child)
Do not actually stop the child inbox, only simulate the liveness check.
|
<U> ActorRef<U> |
unwatch(ActorRef<U> other)
Revoke the registration established by
watch . |
<U> ActorRef<U> |
watch(ActorRef<U> other)
Register for
Terminated notification once the Actor identified by the
given ActorRef terminates. |
child, children, executionContext, getInbox, inbox, mailboxCapacity, name, removeInbox, self, spawnAdapter, system, toString, unwatch, watch
public EffectfulActorContext(java.lang.String _name, Behavior<T> _initialBehavior, int _mailboxCapacity, ActorSystem<scala.runtime.Nothing$> _system)
public Effect getEffect()
public scala.collection.immutable.Seq<Effect> getAllEffects()
public boolean hasEffects()
public void run(T msg)
public void signal(Signal signal)
public <U> ActorRef<U> spawnAnonymous(Behavior<U> behavior, DeploymentConfig deployment)
ActorContext
Props
under a randomly chosen name.
It is good practice to name Actors wherever practical.spawnAnonymous
in interface ActorContext<T>
spawnAnonymous
in class StubbedActorContext<T>
behavior
- (undocumented)deployment
- (undocumented)public <U> ActorRef<U> spawn(Behavior<U> behavior, java.lang.String name, DeploymentConfig deployment)
ActorContext
Props
and with the given name.spawn
in interface ActorContext<T>
spawn
in class StubbedActorContext<T>
behavior
- (undocumented)name
- (undocumented)deployment
- (undocumented)public boolean stop(ActorRef<scala.runtime.Nothing$> child)
StubbedActorContext
stop
in interface ActorContext<T>
stop
in class StubbedActorContext<T>
child
- (undocumented)public <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>
watch
in class StubbedActorContext<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>
unwatch
in class StubbedActorContext<T>
other
- (undocumented)public void setReceiveTimeout(scala.concurrent.duration.FiniteDuration d, T msg)
ActorContext
Duration.Undefined
to switch off this
mechanism.setReceiveTimeout
in interface ActorContext<T>
setReceiveTimeout
in class StubbedActorContext<T>
d
- (undocumented)msg
- (undocumented)public void cancelReceiveTimeout()
ActorContext
cancelReceiveTimeout
in interface ActorContext<T>
cancelReceiveTimeout
in class StubbedActorContext<T>
public <U> Cancellable schedule(scala.concurrent.duration.FiniteDuration delay, ActorRef<U> target, U msg)
ActorContext
Cancellable
cancel
on the returned
handle.schedule
in interface ActorContext<T>
schedule
in class StubbedActorContext<T>
delay
- (undocumented)target
- (undocumented)msg
- (undocumented)