public class ActorCell<T> extends java.lang.Object implements ActorContext<T>, java.lang.Runnable, SupervisionMechanics<T>, DeathWatch<T>
Constructor and Description |
---|
ActorCell(ActorSystem<scala.runtime.Nothing$> system,
Behavior<T> initialBehavior,
scala.concurrent.ExecutionContextExecutor executionContext,
int mailboxCapacity,
ActorRefImpl<scala.runtime.Nothing$> parent) |
Modifier and Type | Method and Description |
---|---|
static int |
activationMask() |
static int |
activations(int status) |
protected static void |
addressTerminated(Address address) |
protected abstract static void |
addWatcher(ActorRefImpl<scala.runtime.Nothing$> watchee,
ActorRefImpl<scala.runtime.Nothing$> watcher) |
static void |
akka$typed$internal$DeathWatch$$watchedBy_$eq(scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> x$1) |
static scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> |
akka$typed$internal$DeathWatch$$watchedBy() |
static void |
akka$typed$internal$DeathWatch$$watching_$eq(scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> x$1) |
static scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> |
akka$typed$internal$DeathWatch$$watching() |
static void |
akka$typed$internal$SupervisionMechanics$$_failed_$eq(java.lang.Throwable x$1) |
static java.lang.Throwable |
akka$typed$internal$SupervisionMechanics$$_failed() |
protected abstract static void |
behavior_$eq(Behavior<T> b) |
protected Behavior<T> |
behavior() |
void |
cancelReceiveTimeout()
Cancel the sending of receive timeout notifications.
|
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.
|
protected scala.collection.immutable.Map<java.lang.String,ActorRefImpl<scala.runtime.Nothing$>> |
childrenMap() |
protected java.lang.Class<?> |
clazz(java.lang.Object o) |
protected ActorContext<T> |
ctx() |
static boolean |
Debug() |
static int |
DefaultState() |
scala.concurrent.ExecutionContextExecutor |
executionContext()
This Actor’s execution context.
|
protected static void |
fail(java.lang.Throwable thr) |
protected static java.lang.Throwable |
failed() |
protected static void |
finishTerminate() |
protected int |
getStatus() |
protected Behavior<T> |
initialBehavior() |
static boolean |
isActive(int status) |
static boolean |
isTerminated(int status) |
protected boolean |
isTerminating() |
int |
mailboxCapacity()
Return the mailbox capacity that was configured by the parent for this actor.
|
static int |
maxActivations() |
protected boolean |
maySend() |
static int |
messageCount(int status) |
protected void |
next(Behavior<T> b,
java.lang.Object msg) |
ActorRefImpl<scala.runtime.Nothing$> |
parent() |
T |
peekMessage() |
protected static boolean |
processSignal(SystemMessage message) |
protected void |
publish(Logging.LogEvent e) |
protected void |
removeChild(ActorRefImpl<scala.runtime.Nothing$> actor) |
protected abstract static void |
remWatcher(ActorRefImpl<scala.runtime.Nothing$> watchee,
ActorRefImpl<scala.runtime.Nothing$> watcher) |
void |
run()
Main entry point into the actor: the ActorCell is a Runnable that is
enqueued in its Executor whenever it needs to run.
|
<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.
|
ActorRefImpl<T> |
self()
The identity of this Actor, bound to the lifecycle of this Actor instance.
|
void |
send(T msg) |
void |
sendSystem(SystemMessage signal) |
protected void |
setClosed() |
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 |
setSelf(ActorRefImpl<T> ref) |
protected void |
setTerminating() |
<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. |
static <U> DeploymentConfig |
spawn$default$3() |
<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(Behavior<U> behavior,
DeploymentConfig deployment)
Create a child Actor from the given
Props under a randomly chosen name. |
static <U> DeploymentConfig |
spawnAnonymous$default$2() |
static long |
statusOffset() |
boolean |
stop(ActorRef<scala.runtime.Nothing$> child)
Force the child Actor under the given name to terminate after it finishes
processing its current message.
|
protected void |
stopAll() |
static int |
SuspendedState() |
static int |
SuspendedWaitForChildrenState() |
ActorSystem<scala.runtime.Nothing$> |
system()
The
ActorSystem to which this Actor belongs. |
static long |
systemQueueOffset() |
protected abstract static void |
tellWatchersWeDied() |
static int |
terminatedBit() |
scala.collection.Iterable<ActorRef<scala.runtime.Nothing$>> |
terminating() |
static int |
terminatingBit() |
protected scala.collection.immutable.Map<java.lang.String,ActorRefImpl<scala.runtime.Nothing$>> |
terminatingMap() |
static int |
terminatingShift() |
java.lang.String |
toString() |
abstract static <U> ActorRef<U> |
unwatch(ActorRef<U> other) |
protected abstract static void |
unwatchWatchedActors() |
abstract static <U> ActorRef<U> |
watch(ActorRef<U> other) |
protected abstract static boolean |
watchedActorTerminated(ActorRefImpl<scala.runtime.Nothing$> actor,
java.lang.Throwable failure) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
unwatch, watch
addWatcher, create, fail, failed, finishTerminate, processSignal, remWatcher, tellWatchersWeDied, terminate, unwatchWatchedActors, watchedActorTerminated
addressTerminated, addWatcher, finishTerminate, maintainAddressTerminatedSubscription, remWatcher, subscribeAddressTerminated, tellWatchersWeDied, unsubscribeAddressTerminated, unwatch, unwatchWatchedActors, watch, watchedActorTerminated
public ActorCell(ActorSystem<scala.runtime.Nothing$> system, Behavior<T> initialBehavior, scala.concurrent.ExecutionContextExecutor executionContext, int mailboxCapacity, ActorRefImpl<scala.runtime.Nothing$> parent)
public static final int terminatingShift()
public static final int activationMask()
public static int maxActivations()
public static final int terminatingBit()
public static final int terminatedBit()
public static boolean isTerminated(int status)
public static boolean isActive(int status)
public static int activations(int status)
public static int messageCount(int status)
public static long statusOffset()
public static long systemQueueOffset()
public static final int DefaultState()
public static final int SuspendedState()
public static final int SuspendedWaitForChildrenState()
public static final boolean Debug()
public static <U> DeploymentConfig spawnAnonymous$default$2()
public static <U> DeploymentConfig spawn$default$3()
protected abstract static void behavior_$eq(Behavior<T> b)
protected abstract static void addWatcher(ActorRefImpl<scala.runtime.Nothing$> watchee, ActorRefImpl<scala.runtime.Nothing$> watcher)
protected abstract static void remWatcher(ActorRefImpl<scala.runtime.Nothing$> watchee, ActorRefImpl<scala.runtime.Nothing$> watcher)
protected abstract static boolean watchedActorTerminated(ActorRefImpl<scala.runtime.Nothing$> actor, java.lang.Throwable failure)
protected abstract static void tellWatchersWeDied()
protected abstract static void unwatchWatchedActors()
protected static boolean processSignal(SystemMessage message)
public static java.lang.Throwable akka$typed$internal$SupervisionMechanics$$_failed()
public static void akka$typed$internal$SupervisionMechanics$$_failed_$eq(java.lang.Throwable x$1)
protected static java.lang.Throwable failed()
protected static void fail(java.lang.Throwable thr)
protected static void finishTerminate()
public static scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> akka$typed$internal$DeathWatch$$watching()
public static void akka$typed$internal$DeathWatch$$watching_$eq(scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> x$1)
public static scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> akka$typed$internal$DeathWatch$$watchedBy()
public static void akka$typed$internal$DeathWatch$$watchedBy_$eq(scala.collection.immutable.Set<ActorRefImpl<scala.runtime.Nothing$>> x$1)
protected static void addressTerminated(Address address)
public ActorSystem<scala.runtime.Nothing$> system()
ActorContext
ActorSystem
to which this Actor belongs.system
in interface ActorContext<T>
system
in interface DeathWatch<T>
system
in interface SupervisionMechanics<T>
protected Behavior<T> initialBehavior()
initialBehavior
in interface SupervisionMechanics<T>
public scala.concurrent.ExecutionContextExecutor executionContext()
ActorContext
Future
combinators.executionContext
in interface ActorContext<T>
public int mailboxCapacity()
ActorContext
mailboxCapacity
in interface ActorContext<T>
public ActorRefImpl<scala.runtime.Nothing$> parent()
parent
in interface DeathWatch<T>
parent
in interface SupervisionMechanics<T>
protected scala.collection.immutable.Map<java.lang.String,ActorRefImpl<scala.runtime.Nothing$>> childrenMap()
childrenMap
in interface DeathWatch<T>
protected scala.collection.immutable.Map<java.lang.String,ActorRefImpl<scala.runtime.Nothing$>> terminatingMap()
terminatingMap
in interface DeathWatch<T>
terminatingMap
in interface SupervisionMechanics<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)protected void removeChild(ActorRefImpl<scala.runtime.Nothing$> actor)
removeChild
in interface DeathWatch<T>
public scala.collection.Iterable<ActorRef<scala.runtime.Nothing$>> terminating()
public void setSelf(ActorRefImpl<T> ref)
public ActorRefImpl<T> self()
ActorContext
ActorRef
.self
in interface ActorContext<T>
self
in interface DeathWatch<T>
self
in interface SupervisionMechanics<T>
protected ActorContext<T> ctx()
ctx
in interface DeathWatch<T>
ctx
in interface SupervisionMechanics<T>
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>
behavior
- (undocumented)name
- (undocumented)deployment
- (undocumented)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>
behavior
- (undocumented)deployment
- (undocumented)public boolean stop(ActorRef<scala.runtime.Nothing$> child)
ActorContext
stop
in interface ActorContext<T>
child
- (undocumented)ActorRef
points to a current child Actorprotected void stopAll()
stopAll
in interface SupervisionMechanics<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>
delay
- (undocumented)target
- (undocumented)msg
- (undocumented)public <U> ActorRef<U> spawnAdapter(scala.Function1<U,T> f)
ActorContext
spawnAdapter
in interface ActorContext<T>
f
- (undocumented)public void setReceiveTimeout(scala.concurrent.duration.FiniteDuration d, T msg)
ActorContext
Duration.Undefined
to switch off this
mechanism.setReceiveTimeout
in interface ActorContext<T>
d
- (undocumented)msg
- (undocumented)public void cancelReceiveTimeout()
ActorContext
cancelReceiveTimeout
in interface ActorContext<T>
protected int getStatus()
public T peekMessage()
protected boolean maySend()
maySend
in interface DeathWatch<T>
maySend
in interface SupervisionMechanics<T>
protected boolean isTerminating()
isTerminating
in interface DeathWatch<T>
protected void setTerminating()
setTerminating
in interface SupervisionMechanics<T>
protected void setClosed()
setClosed
in interface SupervisionMechanics<T>
public void send(T msg)
public void sendSystem(SystemMessage signal)
public final void run()
The idea here is to process at most as many messages as were in queued upon entry of this method, interleaving each normal message with the processing of all system messages that may have accumulated in the meantime. If at the end of the processing messages remain in the queue then this cell is rescheduled.
All coordination occurs via a single Int field that is only updated in wait-free manner (LOCK XADD via unsafe.getAndAddInt), where conflicts are resolved by compensating actions. For a description of the bit usage see the companion object’s source code.
run
in interface java.lang.Runnable
protected Behavior<T> behavior()
behavior
in interface DeathWatch<T>
behavior
in interface SupervisionMechanics<T>
protected void next(Behavior<T> b, java.lang.Object msg)
next
in interface DeathWatch<T>
next
in interface SupervisionMechanics<T>
protected final void publish(Logging.LogEvent e)
publish
in interface DeathWatch<T>
publish
in interface SupervisionMechanics<T>
protected final java.lang.Class<?> clazz(java.lang.Object o)
clazz
in interface DeathWatch<T>
clazz
in interface SupervisionMechanics<T>
public java.lang.String toString()
toString
in class java.lang.Object