Use @apidoc directive in supervision.md (#22904) (#30635)

* Use @apidoc directive in supervision.md (#22904)

* fix typo

Co-authored-by: Arnout Engelen <arnout@engelen.eu>

Co-authored-by: Arnout Engelen <arnout@engelen.eu>
This commit is contained in:
Andrei Arlou 2021-09-10 15:03:53 +03:00 committed by GitHub
parent 31f4d9c9f1
commit b33e479162
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,8 +70,8 @@ ruled out, which leads to the conclusion that the internal state needs to be
cleared out. If the supervisor decides that its other children or itself is not
affected by the corruption—e.g. because of conscious application of the error
kernel pattern—it is therefore best to restart the actor. This is carried out
by creating a new instance of the underlying `Behavior` class and replacing
the failed instance with the fresh one inside the childs `ActorRef`;
by creating a new instance of the underlying @apidoc[Behavior] class and replacing
the failed instance with the fresh one inside the child's @apidoc[typed.ActorRef];
the ability to do this is one of the reasons for encapsulating actors within
special references. The new actor then resumes processing its mailbox, meaning
that the restart is not visible outside of the actor itself with the notable
@ -94,12 +94,12 @@ from alive to dead. Monitoring is thus used to tie one actor to another so that
it may react to the other actors termination, in contrast to supervision which
reacts to failure.
Lifecycle monitoring is implemented using a `Terminated` message to be
Lifecycle monitoring is implemented using a @apidoc[typed.Terminated] message to be
received by the monitoring actor, where the default behavior is to throw a
special `DeathPactException` if not otherwise handled. In order to start
listening for `Terminated` messages, invoke
`ActorContext.watch(targetActorRef)`. To stop listening, invoke
`ActorContext.unwatch(targetActorRef)`. One important property is that the
special @apidoc[typed.DeathPactException] if not otherwise handled. In order to start
listening for @apidoc[typed.Terminated] messages, invoke
@apidoc[ActorContext.watch(targetActorRef)](typed.*.ActorContext) {scala="#watch[U](other:akka.actor.typed.ActorRef[U]):Unit" java="#watch(akka.actor.typed.ActorRef)"}. To stop listening, invoke
@apidoc[ActorContext.unwatch(targetActorRef)](typed.*.ActorContext) {scala="#unwatch[U](other:akka.actor.typed.ActorRef[U]):Unit" java="#unwatch(akka.actor.typed.ActorRef)"}. One important property is that the
message will be delivered irrespective of the order in which the monitoring
request and targets termination occur, i.e. you still get the message even if
at the time of registration the target is already dead.