From 4069be072e8ad7ec53a1d91a639c03ad96d98070 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Wed, 23 Dec 2009 11:36:08 +0000 Subject: Merged revisions 20262-20263,20266-20267,20269-... Merged revisions 20262-20263,20266-20267,20269-20270,20284,20287-20289,20292,20294-20297, 20300 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r20262 | phaller | 2009-12-21 17:03:07 +0100 (Mon, 21 Dec 2009) | 1 line closed #2829. review by rompf. ........ r20263 | phaller | 2009-12-21 17:36:37 +0100 (Mon, 21 Dec 2009) | 1 line small correction in doc comment. no review. ........ r20266 | phaller | 2009-12-21 18:16:55 +0100 (Mon, 21 Dec 2009) | 1 line closed #2181. no review. ........ r20267 | odersky | 2009-12-21 18:30:23 +0100 (Mon, 21 Dec 2009) | 3 lines (1) Added some classes to allow arbitrary patches to source buffers. These are not yet complete so do not need a review yet I think. (2) Avoided reflexive array operations in ScalaRunTime. review by community. ........ r20269 | phaller | 2009-12-21 20:28:18 +0100 (Mon, 21 Dec 2009) | 1 line closed #1449. review by community. ........ r20270 | odersky | 2009-12-21 20:41:51 +0100 (Mon, 21 Dec 2009) | 2 lines Closed #2709. Thanks for the patch! Review by community. ........ r20284 | rytz | 2009-12-22 10:56:21 +0100 (Tue, 22 Dec 2009) | 1 line close #2809. thanks for the small example. review by community ........ r20287 | rytz | 2009-12-22 13:22:56 +0100 (Tue, 22 Dec 2009) | 1 line fix the build. no review. ........ r20288 | prokopec | 2009-12-22 15:00:58 +0100 (Tue, 22 Dec 2009) | 2 lines fixed #2548 - reverse, reverseIterator for views bug. Also - reverseMap for views now should work. review by phaller. ........ r20289 | prokopec | 2009-12-22 15:32:16 +0100 (Tue, 22 Dec 2009) | 2 lines Small change in test. no review ........ r20292 | odersky | 2009-12-22 18:11:54 +0100 (Tue, 22 Dec 2009) | 1 line Closes #2819, #2705, #2805. Review by community. ........ r20294 | odersky | 2009-12-22 18:57:13 +0100 (Tue, 22 Dec 2009) | 1 line Closes #2812 (and removed a left-over println in Types). no review necessary. ........ r20295 | phaller | 2009-12-22 19:15:43 +0100 (Tue, 22 Dec 2009) | 1 line Closes #2538. no review necessary. ........ r20296 | extempore | 2009-12-22 21:11:29 +0100 (Tue, 22 Dec 2009) | 3 lines Took full advantage of the new =>? alias for the superverbosely named PartialFunction by renaming every usage of the latter except when in comments. ........ r20297 | odersky | 2009-12-23 00:42:37 +0100 (Wed, 23 Dec 2009) | 2 lines tentative fix for RC5 lift build problem. ........ r20300 | odersky | 2009-12-23 01:22:11 +0100 (Wed, 23 Dec 2009) | 2 lines Another fix to make lift build under RC5; review by dragos ........ --- src/actors/scala/actors/Actor.scala | 30 ++++----- src/actors/scala/actors/Channel.scala | 8 +-- src/actors/scala/actors/Future.scala | 72 +++++++++++++++------- src/actors/scala/actors/InputChannel.scala | 8 +-- src/actors/scala/actors/ReactChannel.scala | 8 +-- src/actors/scala/actors/Reaction.scala | 2 +- src/actors/scala/actors/Reactor.scala | 8 +-- src/actors/scala/actors/Replyable.scala | 2 +- src/actors/scala/actors/ReplyableActor.scala | 8 +-- src/actors/scala/actors/ReplyableReactor.scala | 2 +- src/actors/scala/actors/remote/Proxy.scala | 2 +- .../scala/actors/scheduler/ThreadPoolConfig.scala | 10 +-- 12 files changed, 96 insertions(+), 64 deletions(-) (limited to 'src/actors') diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 625b19ebdd..fb90cb9c46 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -160,7 +160,7 @@ object Actor { * @param f a partial function specifying patterns and actions * @return the result of processing the received message */ - def receive[A](f: PartialFunction[Any, A]): A = + def receive[A](f: Any =>? A): A = self.receive(f) /** @@ -175,7 +175,7 @@ object Actor { * @param f a partial function specifying patterns and actions * @return the result of processing the received message */ - def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = + def receiveWithin[R](msec: Long)(f: Any =>? R): R = self.receiveWithin(msec)(f) /** @@ -188,7 +188,7 @@ object Actor { * @param f a partial function specifying patterns and actions * @return this function never returns */ - def react(f: PartialFunction[Any, Unit]): Nothing = + def react(f: Any =>? Unit): Nothing = rawSelf.react(f) /** @@ -202,14 +202,14 @@ object Actor { * @param f a partial function specifying patterns and actions * @return this function never returns */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = + def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = self.reactWithin(msec)(f) - def eventloop(f: PartialFunction[Any, Unit]): Nothing = + def eventloop(f: Any =>? Unit): Nothing = rawSelf.react(new RecursiveProxyHandler(rawSelf, f)) - private class RecursiveProxyHandler(a: Reactor, f: PartialFunction[Any, Unit]) - extends PartialFunction[Any, Unit] { + private class RecursiveProxyHandler(a: Reactor, f: Any =>? Unit) + extends (Any =>? Unit) { def isDefinedAt(m: Any): Boolean = true // events are immediately removed from the mailbox def apply(m: Any) { @@ -261,9 +261,9 @@ object Actor { * } * */ - def respondOn[A, B](fun: PartialFunction[A, Unit] => Nothing): - PartialFunction[A, B] => Responder[B] = - (caseBlock: PartialFunction[A, B]) => new Responder[B] { + def respondOn[A, B](fun: A =>? Unit => Nothing): + A =>? B => Responder[B] = + (caseBlock: A =>? B) => new Responder[B] { def respond(k: B => Unit) = fun(caseBlock andThen k) } @@ -428,7 +428,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receive[R](f: PartialFunction[Any, R]): R = { + def receive[R](f: Any =>? R): R = { assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor") synchronized { @@ -479,7 +479,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = { + def receiveWithin[R](msec: Long)(f: Any =>? R): R = { assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor") synchronized { @@ -559,7 +559,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * * @param f a partial function with message patterns and actions */ - override def react(f: PartialFunction[Any, Unit]): Nothing = { + override def react(f: Any =>? Unit): Nothing = { assert(Actor.self(scheduler) == this, "react on channel belonging to other actor") synchronized { if (shouldExit) exit() // links @@ -580,7 +580,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { * @param msec the time span before timeout * @param f a partial function with message patterns and actions */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { + def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = { assert(Actor.self(scheduler) == this, "react on channel belonging to other actor") synchronized { @@ -646,7 +646,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { } // guarded by lock of this - private[actors] override def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) = + private[actors] override def scheduleActor(f: Any =>? Unit, msg: Any) = if ((f eq null) && (continuation eq null)) { // do nothing (timeout is handled instead) } diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala index 24340d22f2..1454f29214 100644 --- a/src/actors/scala/actors/Channel.scala +++ b/src/actors/scala/actors/Channel.scala @@ -76,7 +76,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receive[R](f: PartialFunction[Msg, R]): R = { + def receive[R](f: Msg =>? R): R = { val C = this.asInstanceOf[Channel[Any]] val recvActor = receiver.asInstanceOf[Actor] recvActor.receive { @@ -99,7 +99,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = { + def receiveWithin[R](msec: Long)(f: Any =>? R): R = { val C = this.asInstanceOf[Channel[Any]] val recvActor = receiver.asInstanceOf[Actor] recvActor.receiveWithin(msec) { @@ -116,7 +116,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha * * @param f a partial function with message patterns and actions */ - def react(f: PartialFunction[Msg, Unit]): Nothing = { + def react(f: Msg =>? Unit): Nothing = { val C = this.asInstanceOf[Channel[Any]] receiver.react { case C ! msg if (f.isDefinedAt(msg.asInstanceOf[Msg])) => f(msg.asInstanceOf[Msg]) @@ -133,7 +133,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha * @param msec the time span before timeout * @param f a partial function with message patterns and actions */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { + def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = { val C = this.asInstanceOf[Channel[Any]] val recvActor = receiver.asInstanceOf[Actor] recvActor.reactWithin(msec) { diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index ea0c3a691f..1369ed6255 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -10,6 +10,8 @@ package scala.actors +import scala.actors.scheduler.DaemonScheduler + /** A `Future[T]` is a function of arity 0 that returns * a value of type `T`. * Applying a future blocks the current actor (`Actor.self`) @@ -21,6 +23,7 @@ package scala.actors * @author Philipp Haller */ abstract class Future[+T](val inputChannel: InputChannel[T]) extends Responder[T] with Function0[T] { + @volatile private[actors] var fvalue: Option[Any] = None private[actors] def fvalueTyped = fvalue.get.asInstanceOf[T] @@ -37,7 +40,7 @@ abstract class Future[+T](val inputChannel: InputChannel[T]) extends Responder[T def isSet: Boolean } -/** The Futures object contains methods that operate on futures. +/** The `Futures` object contains methods that operate on futures. * * @author Philipp Haller */ @@ -45,6 +48,39 @@ object Futures { private case object Eval + private class FutureActor[T](fun: () => T, channel: Channel[T]) + extends Future[T](channel) with DaemonActor { + + def isSet = !fvalue.isEmpty + + def apply(): T = { + if (fvalue.isEmpty) + this !? Eval + fvalueTyped + } + + def respond(k: T => Unit) { + if (isSet) k(fvalueTyped) + else { + val ft = this !! Eval + ft.inputChannel.react { + case _ => k(fvalueTyped) + } + } + } + + def act() { + val res = fun() + fvalue = Some(res) + channel ! res + Actor.loop { + Actor.react { + case Eval => Actor.reply() + } + } + } + } + /** Arranges for the asynchronous execution of `body`, * returning a future representing the result. * @@ -53,15 +89,10 @@ object Futures { * computation */ def future[T](body: => T): Future[T] = { - val a = new DaemonActor { - def act() { - Actor.react { - case Eval => Actor.reply(body) - } - } - } + val c = new Channel[T](Actor.self(DaemonScheduler)) + val a = new FutureActor[T](() => body, c) a.start() - a !! (Eval, { case any => any.asInstanceOf[T] }) + a } /** Creates a future that resolves after a given time span. @@ -105,17 +136,10 @@ object Futures { * aborted * @param fts the futures to be awaited * @return the list of optional future values - * @throws `java.lang.IllegalArgumentException` if timeout - * is negative, or timeout + `System.currentTimeMillis()` - * is negative. + * @throws java.lang.IllegalArgumentException if timeout is negative, + * or timeout + `System.currentTimeMillis()` is negative. */ def awaitAll(timeout: Long, fts: Future[Any]*): List[Option[Any]] = { - val thisActor = Actor.self - val timerTask = new java.util.TimerTask { - def run() { thisActor ! TIMEOUT } - } - Actor.timer.schedule(timerTask, timeout) - var resultsMap: collection.mutable.Map[Int, Option[Any]] = new collection.mutable.HashMap[Int, Option[Any]] var cnt = 0 @@ -129,14 +153,20 @@ object Futures { val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => { val FutCh = p._2.inputChannel - val singleCase: PartialFunction[Any, Pair[Int, Any]] = { + val singleCase: Any =>? Pair[Int, Any] = { case FutCh ! any => Pair(p._1, any) } singleCase }) - def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) { - val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] { + val thisActor = Actor.self + val timerTask = new java.util.TimerTask { + def run() { thisActor ! TIMEOUT } + } + Actor.timer.schedule(timerTask, timeout) + + def awaitWith(partFuns: Seq[Any =>? Pair[Int, Any]]) { + val reaction: Any =>? Unit = new (Any =>? Unit) { def isDefinedAt(msg: Any) = msg match { case TIMEOUT => true case _ => partFuns exists (_ isDefinedAt msg) diff --git a/src/actors/scala/actors/InputChannel.scala b/src/actors/scala/actors/InputChannel.scala index 46988159fa..fb922f27b2 100644 --- a/src/actors/scala/actors/InputChannel.scala +++ b/src/actors/scala/actors/InputChannel.scala @@ -25,7 +25,7 @@ trait InputChannel[+Msg] { * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receive[R](f: PartialFunction[Msg, R]): R + def receive[R](f: Msg =>? R): R /** * Receives a message from this InputChannel within @@ -35,7 +35,7 @@ trait InputChannel[+Msg] { * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R + def receiveWithin[R](msec: Long)(f: Any =>? R): R /** * Receives a message from this InputChannel. @@ -45,7 +45,7 @@ trait InputChannel[+Msg] { * * @param f a partial function with message patterns and actions */ - def react(f: PartialFunction[Msg, Unit]): Nothing + def react(f: Msg =>? Unit): Nothing /** * Receives a message from this InputChannel within @@ -57,7 +57,7 @@ trait InputChannel[+Msg] { * @param msec the time span before timeout * @param f a partial function with message patterns and actions */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing + def reactWithin(msec: Long)(f: Any =>? Unit): Nothing /** * Receives the next message from this Channel. diff --git a/src/actors/scala/actors/ReactChannel.scala b/src/actors/scala/actors/ReactChannel.scala index 8bbbc04f53..926805fbe7 100644 --- a/src/actors/scala/actors/ReactChannel.scala +++ b/src/actors/scala/actors/ReactChannel.scala @@ -55,7 +55,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[ * * @param f a partial function with message patterns and actions */ - def react(f: PartialFunction[Msg, Unit]): Nothing = { + def react(f: Msg =>? Unit): Nothing = { val C = this receiver.react { case SendToReactor(C, msg) if (f.isDefinedAt(msg.asInstanceOf[Msg])) => @@ -73,7 +73,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[ * @param msec the time span before timeout * @param f a partial function with message patterns and actions */ - def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { + def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = { val C = this val recvActor = receiver.asInstanceOf[Actor] recvActor.reactWithin(msec) { @@ -89,7 +89,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[ * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receive[R](f: PartialFunction[Msg, R]): R = { + def receive[R](f: Msg =>? R): R = { val C = this val recvActor = receiver.asInstanceOf[Actor] recvActor.receive { @@ -106,7 +106,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[ * @param f a partial function with message patterns and actions * @return result of processing the received value */ - def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = { + def receiveWithin[R](msec: Long)(f: Any =>? R): R = { val C = this val recvActor = receiver.asInstanceOf[Actor] recvActor.receiveWithin(msec) { diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala index 25aea803af..a4736f9489 100644 --- a/src/actors/scala/actors/Reaction.scala +++ b/src/actors/scala/actors/Reaction.scala @@ -26,7 +26,7 @@ private[actors] class KillActorException extends Throwable with ControlException * @deprecated("this class is going to be removed in a future release") * @author Philipp Haller */ -class Reaction(a: Actor, f: PartialFunction[Any, Unit], msg: Any) extends ActorTask(a, () => { +class Reaction(a: Actor, f: Any =>? Unit, msg: Any) extends ActorTask(a, () => { if (f == null) a.act() else diff --git a/src/actors/scala/actors/Reactor.scala b/src/actors/scala/actors/Reactor.scala index 0eff67c163..d641f54eb6 100644 --- a/src/actors/scala/actors/Reactor.scala +++ b/src/actors/scala/actors/Reactor.scala @@ -41,7 +41,7 @@ trait Reactor extends OutputChannel[Any] { * message handler that react was called with. */ @volatile - private[actors] var continuation: PartialFunction[Any, Unit] = null + private[actors] var continuation: Any =>? Unit = null /* Whenever this Actor executes on some thread, waitingFor is * guaranteed to be equal to waitingForNone. @@ -61,7 +61,7 @@ trait Reactor extends OutputChannel[Any] { */ def act(): Unit - protected[actors] def exceptionHandler: PartialFunction[Exception, Unit] = + protected[actors] def exceptionHandler: Exception =>? Unit = Map() protected[actors] def scheduler: IScheduler = @@ -159,7 +159,7 @@ trait Reactor extends OutputChannel[Any] { } } - protected[actors] def react(f: PartialFunction[Any, Unit]): Nothing = { + protected[actors] def react(f: Any =>? Unit): Nothing = { assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor") synchronized { drainSendBuffer(mailbox) } continuation = f @@ -172,7 +172,7 @@ trait Reactor extends OutputChannel[Any] { * * assume handler != null */ - private[actors] def scheduleActor(handler: PartialFunction[Any, Unit], msg: Any) = { + private[actors] def scheduleActor(handler: Any =>? Unit, msg: Any) = { val fun = () => handler(msg) val task = new ReactorTask(this, fun) scheduler executeFromActor task diff --git a/src/actors/scala/actors/Replyable.scala b/src/actors/scala/actors/Replyable.scala index 2c7e55e06a..b1ccb3205e 100644 --- a/src/actors/scala/actors/Replyable.scala +++ b/src/actors/scala/actors/Replyable.scala @@ -59,7 +59,7 @@ trait Replyable[-T, +R] { * @param f the function to be applied to the response * @return the future */ - def !![P](msg: T, f: PartialFunction[R, P]): () => P = + def !![P](msg: T, f: R =>? P): () => P = () => f(this !? msg) } diff --git a/src/actors/scala/actors/ReplyableActor.scala b/src/actors/scala/actors/ReplyableActor.scala index 2122dd854b..b562dbf855 100644 --- a/src/actors/scala/actors/ReplyableActor.scala +++ b/src/actors/scala/actors/ReplyableActor.scala @@ -62,7 +62,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { * f. This also allows to recover a more * precise type for the reply value. */ - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { + override def !![A](msg: Any, f: Any =>? A): Future[A] = { val ftch = new Channel[A](Actor.self(thiz.scheduler)) thiz.send(msg, new OutputChannel[Any] { def !(msg: Any) = @@ -108,7 +108,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { Futures.fromInputChannel(someChan) } // should never be invoked; return dummy value - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { + override def !![A](msg: Any, f: Any =>? A): Future[A] = { val someChan = new Channel[A](Actor.self(thiz.scheduler)) Futures.fromInputChannel(someChan) } @@ -117,7 +117,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { thiz.send(msg, linkedChannel) new Future[Any](ftch) { var exitReason: Option[Any] = None - val handleReply: PartialFunction[Any, Unit] = { + val handleReply: Any =>? Unit = { case Exit(from, reason) => exitReason = Some(reason) case any => @@ -145,7 +145,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor { def isSet = (fvalue match { case None => - val handleTimeout: PartialFunction[Any, Boolean] = { + val handleTimeout: Any =>? Boolean = { case TIMEOUT => false } diff --git a/src/actors/scala/actors/ReplyableReactor.scala b/src/actors/scala/actors/ReplyableReactor.scala index ecca50e26d..f5a2752f54 100644 --- a/src/actors/scala/actors/ReplyableReactor.scala +++ b/src/actors/scala/actors/ReplyableReactor.scala @@ -70,7 +70,7 @@ private[actors] trait ReplyableReactor extends Replyable[Any, Any] { * f. This also allows to recover a more * precise type for the reply value. */ - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { + override def !![A](msg: Any, f: Any =>? A): Future[A] = { val myself = Actor.rawSelf(this.scheduler) val ftch = new ReactChannel[A](myself) val res = new scala.concurrent.SyncVar[A] diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala index f9a6cd8fed..c1744a2dfc 100644 --- a/src/actors/scala/actors/remote/Proxy.scala +++ b/src/actors/scala/actors/remote/Proxy.scala @@ -69,7 +69,7 @@ private[remote] class Proxy(node: Node, name: Symbol, @transient var kernel: Net override def !!(msg: Any): Future[Any] = del !! msg - override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = + override def !![A](msg: Any, f: Any =>? A): Future[A] = del !! (msg, f) def linkTo(to: AbstractActor): Unit = diff --git a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala index 5ffbc80421..93112ae80a 100644 --- a/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala +++ b/src/actors/scala/actors/scheduler/ThreadPoolConfig.scala @@ -36,10 +36,12 @@ object ThreadPoolConfig { } } - val maxPoolSize = getIntegerProp("actors.maxPoolSize") match { - case Some(i) if (i >= corePoolSize) => i - case Some(i) if (i < corePoolSize) => corePoolSize - case _ => 256 + val maxPoolSize = { + val preMaxSize = getIntegerProp("actors.maxPoolSize") match { + case Some(i) => i + case _ => 256 + } + if (preMaxSize >= corePoolSize) preMaxSize else corePoolSize } private[actors] def useForkJoin: Boolean = -- cgit v1.2.3