How to restart an already terminated actor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to restart an already terminated actor

Mario Garcia
Hi:

I was wondering what would be the best approach when an actor's body throws an exception. 

As far as I know I have onException/handleException methods to do something when an exception has been thrown in order to do an ordered shutdown of the actor (i.e. close database connection...etc). But then actor stops and is no longer able to receive messages.

Let's say I have an actor receiving a non expected value and throwing an exception, but I don't want that actor to stop receiving values.
  • Do I have to create another actor's instance ?
  • Do I have to create a supervisor actor to create that new instance ?
  • Is there any supervisor-like concept in GPars ?
  • Could I do something inside the actor, apart from writing a try-catch block, to handle the exception and make it keep going ?
Thanks
Mario

Reply | Threaded
Open this post in threaded view
|

Re: How to restart an already terminated actor

Vaclav
Administrator
Hello Mario,

unfortunately, GPars doesn't support actor restarting ATM. We've been planning this for quite some time, but never got to really implementing it.

Cheers,

Vaclav




On Fri, May 16, 2014 at 12:39 AM, Mario Garcia <[hidden email]> wrote:
Hi:

I was wondering what would be the best approach when an actor's body throws an exception. 

As far as I know I have onException/handleException methods to do something when an exception has been thrown in order to do an ordered shutdown of the actor (i.e. close database connection...etc). But then actor stops and is no longer able to receive messages.

Let's say I have an actor receiving a non expected value and throwing an exception, but I don't want that actor to stop receiving values.
  • Do I have to create another actor's instance ?
  • Do I have to create a supervisor actor to create that new instance ?
  • Is there any supervisor-like concept in GPars ?
  • Could I do something inside the actor, apart from writing a try-catch block, to handle the exception and make it keep going ?
Thanks
Mario




--
E-mail: [hidden email]
Blog: http://www.jroller.com/vaclav
Linkedin page: http://www.linkedin.com/in/vaclavpech