Akka.Actor: Added built-in IntentionalRestart message to test actor restart behaviors#7493
Conversation
Aaronontheweb
left a comment
There was a problem hiding this comment.
Detailed my changes
| public Akka.Actor.IActorRef Watch(Akka.Actor.IActorRef subject) { } | ||
| public Akka.Actor.IActorRef WatchWith(Akka.Actor.IActorRef subject, object message) { } | ||
| } | ||
| public sealed class IntentionalActorRestartException : Akka.Actor.AkkaException |
There was a problem hiding this comment.
Added a new IntentionalActorRestartException and an IntentionalRestart auto-received message. I hope the naming makes it obvious why these exist.
There was a problem hiding this comment.
misc-serializer support for IntentionalRestart
| TestActor.Tell(mess); | ||
|
|
||
| // can't relay the Restart back because that will blow up the TestActor | ||
| if (mess is not IntentionalRestart) |
There was a problem hiding this comment.
Can't reply back with the IntentionalRestart message because it will crash the TestActor.
|
|
||
| switch (message) | ||
| { | ||
| case ActorSelectionMessage selectionMessage: |
There was a problem hiding this comment.
Re-organized the switch order for performance reasons - with the most frequent messages appearing first for short-circuiting reasons.
| break; | ||
| case Identify identify: | ||
| HandleIdentity(identify); | ||
| case Akka.Actor.IntentionalRestart: |
There was a problem hiding this comment.
Added restart handling here - it just throws an IntentionalActorRestartException
Changes
close #7492
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):