This repository was archived by the owner on Feb 23, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-12
lines changed Expand file tree Collapse file tree 3 files changed +31
-12
lines changed Original file line number Diff line number Diff line change @@ -589,18 +589,21 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
589
589
done = true
590
590
receiveTimeout
591
591
} else {
592
- waitingFor = f
593
- received = None
594
- isSuspended = true
595
- val thisActor = this
596
- onTimeout = Some (new TimerTask {
597
- def run () { thisActor.send(TIMEOUT , thisActor) }
598
- })
599
- Actor .timer.schedule(onTimeout.get, msec)
600
- scheduler.managedBlock(blocker)
601
- drainSendBuffer(mailbox)
602
- // keep going
603
- () => {}
592
+ if (onTimeout.isEmpty) {
593
+ waitingFor = f
594
+ received = None
595
+ isSuspended = true
596
+ val thisActor = this
597
+ onTimeout = Some (new TimerTask {
598
+ def run () { thisActor.send(TIMEOUT , thisActor) }
599
+ })
600
+ Actor .timer.schedule(onTimeout.get, msec)
601
+ scheduler.managedBlock(blocker)
602
+ drainSendBuffer(mailbox)
603
+ // keep going
604
+ () => {}
605
+ } else
606
+ sys.error(" unhandled timeout" )
604
607
}
605
608
}
606
609
todo()
Original file line number Diff line number Diff line change
1
+ caught java.lang.RuntimeException: unhandled timeout
Original file line number Diff line number Diff line change
1
+ import scala .actors .Actor ._
2
+
3
+ object Test {
4
+ def main (args : Array [String ]) {
5
+ actor {
6
+ try {
7
+ receiveWithin(1 ) {
8
+ case str : String => println(str)
9
+ }
10
+ } catch {
11
+ case e : Exception => println(" caught " + e)
12
+ }
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments