-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Akka.Actor: Added built-in IntentionalRestart
message to test actor restart behaviors
#7493
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detailed my changes
@@ -1264,6 +1264,15 @@ namespace Akka.Actor | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't reply back with the IntentionalRestart
message because it will crash the TestActor
.
@@ -132,27 +132,38 @@ protected internal virtual void AutoReceiveMessage(Envelope envelope) | |||
|
|||
switch (message) | |||
{ | |||
case ActorSelectionMessage selectionMessage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added restart handling here - it just throws an IntentionalActorRestartException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
close #7492
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):