Hi, how do you avoid this: if (actor.getState == Actor.State.Terminated) actor.restartelse actor.start Why you can not start an actor two times? Thanks in advance,Etam.
I'd say that starting an actor and restarting an actor are sufficiently semantically different to justify different calls and an error if you try to do the wrong one. You should generally know based on context whether it's the first time you are starting the actor, or if you are restarting it. So doing one instead of the other in most circumstances would represent a bug. That's not to say there aren't legitimate code structures where the same path handles starting and restarting. I just think it would be the much less common case.
I'd say that starting an actor and restarting an actor are sufficiently semantically different to justify different calls and an error if you try to do the wrong one. You should generally know based on context whether it's the first time you are starting the actor, or if you are restarting it. So doing one instead of the other in most circumstances would represent a bug. That's not to say there aren't legitimate code structures where the same path handles starting and restarting. I just think it would be the much less common case.