The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ebowman (2) [Avatar] Offline
#1
After the first failure, the system stops.

Is that intentional?

Adding:

override def postRestart(reason: Throwable): Unit = self ! Start

...to FirstActor is one way (the best way?) to solve it.
jamie.allen (13) [Avatar] Offline
#2
Re: chapter 2 actor example doesn't work as expected
Hey, Eric! How are you running it? If I execute it in SBT or from the IDE, I see it restart just fine - the Start call on postRestart() is in the AbstractCounterActor class that both FirstActor and SecondActor inherit from. Putting a postRestart in FirstActor only works if that's the one that always fails, which may or may not be the case.

Since the restart could occur in either First or Second, I'd have to have slightly different implementations of the postRestart call for both, or I could have the behavior in one place and route it through the context.parent, which is the SupervisorActor for both.

Let me know what you're seeing and how you're running it - maybe I missed an edge case. Thanks!
ebowman (2) [Avatar] Offline
#3
Re: chapter 2 actor example doesn't work as expected
Doh ... I typed it in and missed the postRestart in the abstract actor. Move along, nothing to see here. smilie

Book looks great so far, thanks!
jamie.allen (13) [Avatar] Offline
#4
Re: chapter 2 actor example doesn't work as expected
Whew, glad it worked. Thanks!