Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala Remote Actors - Pitfalls

While writing Scala RemoteActor code, I noticed some pitfalls:

  • RemoteActor.classLoader = getClass().getClassLoader() has to be set in order to avoid "java.lang.ClassNotFoundException"
  • link doesn't always work due to "a race condition for which a NetKernel (the facility responsible for forwarding messages remotely) that backs a remote actor can close before the remote actor's proxy (more specifically, proxy delegate) has had a chance to send a message remotely indicating the local exit." (Stephan Tu)
  • RemoteActor.select doesn't always return the same delegate (RemoteActor.select - result deterministic?)
  • Sending a delegate over the network prevents the application to quit normally (RemoteActor unregister actor)
  • Remote Actors won't terminate if RemoteActor.alive() and RemoteActor.register() are used outside act. (See the answer of Magnus)

Are there any other pitfalls a programmer should be aware of?

like image 317
Stefan K. Avatar asked Nov 06 '22 10:11

Stefan K.


1 Answers

Here's another; you need to put your RemoteActor.alive() and RemoteActor.register() calls inside your act method when you define your actor or the actor won't terminate when you call exit(); see How do I kill a RemoteActor?

like image 157
Magnus Avatar answered Nov 18 '22 10:11

Magnus