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

Actors: 2.7.7 throws timeout exception while 2.8.0 does not

1 reply
obraun
Joined: 2010-05-04,
User offline. Last seen 1 year 41 weeks ago.

Hi all,

I saw different behaviour when using actors with 2.7.7 and 2.8.0. Only
receiveWithin(0) throws an exception on 2.8.0. receiveWithin(x) with x>0
blocks infinitly.

Is this intended. If yes, why?

Welcome to Scala version 2.7.7...
scala> import scala.actors.Actor._
import scala.actors.Actor._
scala> receiveWithin(0) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
...
scala> receiveWithin(1) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
...

Welcome to Scala version 2.8.0...
scala> import scala.actors.Actor._
import scala.actors.Actor._
scala> receiveWithin(0) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
...
scala> receiveWithin(1) { case msg: String => }

The last statement blocks infinitly!

Regards
Oliver

E. Labun
Joined: 2010-06-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Actors: 2.7.7 throws timeout exception while 2.8.0 does not
Moreover, doing the following causes the Scala Console to freeze too:

Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import scala.actors._                                                     
import scala.actors._

scala> import Actor._                                                            
import Actor._

scala> receiveWithin(1) { case TIMEOUT => println("timeout"); case msg: String => }
timeout

scala> :q
^^^^^^^^^^^^ blocks infinitly
I.e. it's impossible to quit the Scala Console properly.

Interesting, the ":q" command does work with receiveWithin(0) in the case above...


- Eugen

On 2010-07-28 15:30, Oliver Braun wrote:
slrni50c8e [dot] fn7 [dot] ob [at] amce [dot] unsane [dot] de" type="cite">
Hi all,

I saw different behaviour when using actors with 2.7.7 and 2.8.0. Only
receiveWithin(0) throws an exception on 2.8.0. receiveWithin(x) with x>0
blocks infinitly.

Is this intended. If yes, why?

Welcome to Scala version 2.7.7...
scala> import scala.actors.Actor._
import scala.actors.Actor._
scala> receiveWithin(0) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
  ...
scala> receiveWithin(1) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
  ...

Welcome to Scala version 2.8.0...
scala> import scala.actors.Actor._
import scala.actors.Actor._
scala> receiveWithin(0) { case msg: String => }
java.lang.RuntimeException: unhandled timeout
  ...
scala> receiveWithin(1) { case msg: String => }

The last statement blocks infinitly!

Regards
         Oliver

  

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