summaryrefslogtreecommitdiff
path: root/test/files/jvm/actor-executor2.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/jvm/actor-executor2.scala')
-rw-r--r--test/files/jvm/actor-executor2.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/files/jvm/actor-executor2.scala b/test/files/jvm/actor-executor2.scala
index da64a7fc43..f8fcaef69f 100644
--- a/test/files/jvm/actor-executor2.scala
+++ b/test/files/jvm/actor-executor2.scala
@@ -1,6 +1,6 @@
import scala.actors.{Actor, SchedulerAdapter, Exit}
import Actor._
-import java.util.concurrent.Executors
+import java.util.concurrent.{Executors, RejectedExecutionException}
object One extends AdaptedActor {
def act() {
@@ -57,9 +57,15 @@ object Test {
val scheduler =
new SchedulerAdapter {
def execute(block: => Unit) {
- executor.execute(new Runnable {
+ val task = new Runnable {
def run() { block }
- })
+ }
+ try {
+ executor.execute(task)
+ } catch {
+ case ree: RejectedExecutionException =>
+ task.run() // run task on current thread
+ }
}
}