This page is no longer maintained — Please continue to the home page at www.scala-lang.org

semantics of suspending actor operations for ActorProxy

1 reply
Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
By "suspending operations" I mean ops that cause an exception to be thrown that would normally return control from "user code" to the actor library by being handled in Reaction, such as react, reactWithin, loop, etc.  Currently these operations blow away the current thread because the exception goes unhandled, and the ActorProxy is scheduled on the default scheduler to handle to perform actions.  This doesn't seem like a very friendly behavior.
Different options are:1.  Override these operations for ActorProxy so that they block or otherwise don't raise exceptions    - this causes problems because most (all?) of these methods have a return type of Nothing, which means they aren't supposed to return 2.  Let them destroy the thread, but attempt to cleanly handle them by registering an uncaught exception handler for the thread    - this seems like the logical thing to do3.  Throw an exception immediately when they are attempted because they are invalid for threads that aren't managed by the actor library 4.  Leave it as it is, just make sure it doesn't result in any leaks
Thoughts?
-Erik

David Pollak
Joined: 2008-12-16,
User offline. Last seen 42 years 45 weeks ago.
Re: semantics of suspending actor operations for ActorProxy
My vote is with #2

On Wed, May 20, 2009 at 9:11 PM, Erik Engbrecht <erik.engbrecht@gmail.com> wrote:
By "suspending operations" I mean ops that cause an exception to be thrown that would normally return control from "user code" to the actor library by being handled in Reaction, such as react, reactWithin, loop, etc.  Currently these operations blow away the current thread because the exception goes unhandled, and the ActorProxy is scheduled on the default scheduler to handle to perform actions.  This doesn't seem like a very friendly behavior.
Different options are:1.  Override these operations for ActorProxy so that they block or otherwise don't raise exceptions    - this causes problems because most (all?) of these methods have a return type of Nothing, which means they aren't supposed to return 2.  Let them destroy the thread, but attempt to cleanly handle them by registering an uncaught exception handler for the thread    - this seems like the logical thing to do3.  Throw an exception immediately when they are attempted because they are invalid for threads that aren't managed by the actor library 4.  Leave it as it is, just make sure it doesn't result in any leaks
Thoughts?
-Erik




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland