diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-09-24 18:48:39 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-09-24 18:48:39 +0000 |
commit | 8f8096f0ab3d1166af88ce60419ade40911ac327 (patch) | |
tree | 529ac0c48ffff13274140e3df757b5ab40530ef4 /src/actors | |
parent | 92fc7b37b01bc871966a49524197c1cbbeec8988 (diff) | |
download | scala-8f8096f0ab3d1166af88ce60419ade40911ac327.tar.gz scala-8f8096f0ab3d1166af88ce60419ade40911ac327.tar.bz2 scala-8f8096f0ab3d1166af88ce60419ade40911ac327.zip |
Tightened access modifiers in Reactor and Actor...
Tightened access modifiers in Reactor and Actor, so that fewer methods
are user-visible (showing up in scaladoc).
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 6 | ||||
-rw-r--r-- | src/actors/scala/actors/Reactor.scala | 22 | ||||
-rw-r--r-- | src/actors/scala/actors/ReplyReactor.scala | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 82ebe5059f..e4f93575f3 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -406,14 +406,14 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { def run() = fun() } - protected[this] override def makeReaction(fun: () => Unit): Runnable = { + private[actors] override def makeReaction(fun: () => Unit): Runnable = { if (isSuspended) new RunCallable(fun) else new ActorTask(this, fun) } - protected[this] override def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { + private[actors] override def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { if (!onTimeout.isEmpty) { onTimeout.get.cancel() onTimeout = None @@ -638,7 +638,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor { } // guarded by lock of this - protected[this] override def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) = + private[actors] override def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) = if ((f eq null) && (continuation eq null)) { // do nothing (timeout is handled instead) } diff --git a/src/actors/scala/actors/Reactor.scala b/src/actors/scala/actors/Reactor.scala index c07612f1eb..edc58c2ba5 100644 --- a/src/actors/scala/actors/Reactor.scala +++ b/src/actors/scala/actors/Reactor.scala @@ -20,14 +20,14 @@ import scala.collection.mutable.Queue trait Reactor extends OutputChannel[Any] { /* The actor's mailbox. */ - protected[this] val mailbox = new MessageQueue("Reactor") + private[actors] val mailbox = new MessageQueue("Reactor") - protected[this] var sendBuffer = new Queue[(Any, OutputChannel[Any])] + private[actors] var sendBuffer = new Queue[(Any, OutputChannel[Any])] /* If the actor waits in a react, continuation holds the * message handler that react was called with. */ - protected[this] var continuation: PartialFunction[Any, Unit] = null + private[actors] var continuation: PartialFunction[Any, Unit] = null /* Whenever this Actor executes on some thread, waitingFor is * guaranteed to be equal to waitingForNone. @@ -36,8 +36,8 @@ trait Reactor extends OutputChannel[Any] { * waitingForNone, this Actor is guaranteed not to execute on some * thread. */ - protected[this] val waitingForNone = (m: Any) => false - protected[this] var waitingFor: Any => Boolean = waitingForNone + private[actors] val waitingForNone = (m: Any) => false + private[actors] var waitingFor: Any => Boolean = waitingForNone /** * The behavior of an actor is specified by implementing this @@ -79,10 +79,10 @@ trait Reactor extends OutputChannel[Any] { todo() } - protected[this] def makeReaction(fun: () => Unit): Runnable = + private[actors] def makeReaction(fun: () => Unit): Runnable = new ReactorTask(this, fun) - protected[this] def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { + private[actors] def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { // assert continuation != null if (onSameThread) continuation(item._1) @@ -100,7 +100,7 @@ trait Reactor extends OutputChannel[Any] { def receiver: Actor = this.asInstanceOf[Actor] - protected[this] def drainSendBuffer(mbox: MessageQueue) { + private[actors] def drainSendBuffer(mbox: MessageQueue) { while (!sendBuffer.isEmpty) { val item = sendBuffer.dequeue() mbox.append(item._1, item._2) @@ -108,7 +108,7 @@ trait Reactor extends OutputChannel[Any] { } // assume continuation has been set - protected[this] def searchMailbox(startMbox: MessageQueue, + private[actors] def searchMailbox(startMbox: MessageQueue, handlesMessage: Any => Boolean, resumeOnSameThread: Boolean) { var tmpMbox = startMbox @@ -147,7 +147,7 @@ trait Reactor extends OutputChannel[Any] { /* This method is guaranteed to be executed from inside an actors act method. */ - protected[this] def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) = { + private[actors] def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) = { scheduler executeFromActor (new LightReaction(this, if (f eq null) continuation else f, msg)) @@ -189,7 +189,7 @@ trait Reactor extends OutputChannel[Any] { throw Actor.suspendException } - protected[actors] def terminated() { + private[actors] def terminated() { scheduler.terminated(this) } diff --git a/src/actors/scala/actors/ReplyReactor.scala b/src/actors/scala/actors/ReplyReactor.scala index 1fb564f626..be05c9cd35 100644 --- a/src/actors/scala/actors/ReplyReactor.scala +++ b/src/actors/scala/actors/ReplyReactor.scala @@ -24,7 +24,7 @@ trait ReplyReactor extends Reactor { /* A list of the current senders. The head of the list is * the sender of the message that was received last. */ - protected var senders: List[OutputChannel[Any]] = + private[actors] var senders: List[OutputChannel[Any]] = Nil protected[actors] def sender: OutputChannel[Any] = @@ -51,7 +51,7 @@ trait ReplyReactor extends Reactor { send(msg, Actor.sender) } - override protected[this] def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { + private[actors] override def resumeReceiver(item: (Any, OutputChannel[Any]), onSameThread: Boolean) { senders = List(item._2) // assert continuation != null if (onSameThread) |