Check if a Scala / Akka actor is terminated -


While executing code inside an actor, I have to see whether the actor should still be advised whether the actor is still alive Or is there a better way?

  If (self! = Akka.actor.DeadLetter) {// do something}   

Thanks!

Edit ---

Thanks for all your input what is the following is I am using play on the start of my actor, on an incoming request, Timeout is scheduled.

  Promise. Timeout ({Logger.info (s "$ self, expired") // Something}, timeout)   

For other reasons before the expiration The actor is stopped (for example, the client disconnects). In that case, which I see in logs

  actor [akka: // application / deadLetters], the expiration period has expired.   

In my understanding, this means that the default deadLetters is executing that code. So my question is really: after the ending of the actor promises that what code is executed and what is the best way to stop it from moving forward?

If your actor is dead, then there will be no code inside the actor.

You can see if a specific actor is available, with it, and then send a message to any message returned as a result (if nothing will happen, no message will be sent).

  ActorContext actor selection (& lt; name of your actor & gt;)! Some messages    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -