- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Actors: 2.7.7 throws timeout exception while 2.8.0 does not
Wed, 2010-07-28, 14:31
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
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: