summaryrefslogtreecommitdiff
path: root/src/actors
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2011-07-15 20:20:47 +0000
committermichelou <michelou@epfl.ch>2011-07-15 20:20:47 +0000
commita4fb15861b271c41fba8382f3b55024b5fdc8155 (patch)
tree30e406cf90ed5c2fb6e87d1f72e300c1749d4452 /src/actors
parenta0476af6bce252a7e724e6e99e50a80f0021ce78 (diff)
downloadscala-a4fb15861b271c41fba8382f3b55024b5fdc8155.tar.gz
scala-a4fb15861b271c41fba8382f3b55024b5fdc8155.tar.bz2
scala-a4fb15861b271c41fba8382f3b55024b5fdc8155.zip
3rd round of clean ups (see r25285, r25292)
Diffstat (limited to 'src/actors')
-rw-r--r--src/actors/scala/actors/Actor.scala269
-rw-r--r--src/actors/scala/actors/ActorProxy.scala5
-rw-r--r--src/actors/scala/actors/CanReply.scala25
-rw-r--r--src/actors/scala/actors/Channel.scala11
-rw-r--r--src/actors/scala/actors/DaemonActor.scala5
-rw-r--r--src/actors/scala/actors/IScheduler.scala10
-rw-r--r--src/actors/scala/actors/MessageQueue.scala17
-rw-r--r--src/actors/scala/actors/OutputChannel.scala9
-rw-r--r--src/actors/scala/actors/ReactChannel.scala28
-rw-r--r--src/actors/scala/actors/ReplyReactor.scala12
-rw-r--r--src/actors/scala/actors/Scheduler.scala4
-rw-r--r--src/actors/scala/actors/remote/TcpService.scala2
-rw-r--r--src/actors/scala/actors/scheduler/ActorGC.scala8
-rw-r--r--src/actors/scala/actors/scheduler/QuitControl.scala4
-rw-r--r--src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala11
15 files changed, 176 insertions, 244 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 57e107538c..ba4d90f0b3 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -6,39 +6,35 @@
** |/ **
\* */
-
package scala.actors
import scala.util.control.ControlThrowable
import java.util.{Timer, TimerTask}
/**
- * Provides functions for the definition of
- * actors, as well as actor operations, such as
- * <code>receive</code>, <code>react</code>, <code>reply</code>,
- * etc.
+ * Provides functions for the definition of actors, as well as actor
+ * operations, such as `receive`, `react`, `reply`, etc.
*
* @author Philipp Haller
*/
object Actor extends Combinators {
/** State of an actor.
- * <ul>
- * <li><b>New</b> -
- * Not yet started</li>
- * <li><b>Runnable</b> -
- * Executing</li>
- * <li><b>Suspended</b> -
- * Suspended, waiting in a `react`</li>
- * <li><b>TimedSuspended</b> -
- * Suspended, waiting in a `reactWithin` </li>
- * <li><b>Blocked</b> -
- * Blocked waiting in a `receive` </li>
- * <li><b>TimedBlocked</b> -
- * Blocked waiting in a `receiveWithin` </li>
- * <li><b>Terminated</b> -
- * Actor has terminated </li>
- * </ul>
+ *
+ * - '''New''' -
+ * Not yet started
+ * - '''Runnable''' -
+ * Executing
+ * - '''Suspended''' -
+ * Suspended, waiting in a `react`
+ * - '''TimedSuspended''' -
+ * Suspended, waiting in a `reactWithin`
+ * - '''Blocked''' -
+ * Blocked waiting in a `receive`
+ * - '''TimedBlocked''' -
+ * Blocked waiting in a `receiveWithin`
+ * - '''Terminated''' -
+ * Actor has terminated
*/
object State extends Enumeration {
val New,
@@ -59,8 +55,7 @@ object Actor extends Combinators {
/**
* Returns the currently executing actor. Should be used instead
- * of <code>this</code> in all blocks of code executed by
- * actors.
+ * of `'''this'''` in all blocks of code executed by actors.
*
* @return returns the currently executing actor.
*/
@@ -89,11 +84,11 @@ object Actor extends Combinators {
/**
* Resets an actor proxy associated with the current thread.
- * It replaces the implicit <code>ActorProxy</code> instance
+ * It replaces the implicit `ActorProxy` instance
* of the current thread (if any) with a new instance.
*
* This permits to re-use the current thread as an actor
- * even if its <code>ActorProxy</code> has died for some reason.
+ * even if its `ActorProxy` has died for some reason.
*/
def resetProxy() {
val a = tl.get
@@ -102,16 +97,15 @@ object Actor extends Combinators {
}
/**
- * Removes any reference to an <code>Actor</code> instance
+ * Removes any reference to an `Actor` instance
* currently stored in thread-local storage.
*
- * This allows to release references from threads that are
- * potentially long-running or being re-used (e.g. inside
- * a thread pool). Permanent references in thread-local storage
- * are a potential memory leak.
+ * This allows to release references from threads that are potentially
+ * long-running or being re-used (e.g. inside a thread pool). Permanent
+ * references in thread-local storage are a potential memory leak.
*/
def clearSelf() {
- tl.set(null)
+ tl set null
}
/**
@@ -168,15 +162,13 @@ object Actor extends Combinators {
}
/**
- * Receives the next message from the mailbox of the current actor
- * <code>self</code>.
+ * Receives the next message from the mailbox of the current actor `self`.
*/
def ? : Any = self.?
/**
- * Receives a message from the mailbox of
- * <code>self</code>. Blocks if no message matching any of the
- * cases of <code>f</code> can be received.
+ * Receives a message from the mailbox of `self`. Blocks if no message
+ * matching any of the cases of `f` can be received.
*
* @example {{{
* receive {
@@ -193,12 +185,10 @@ object Actor extends Combinators {
self.receive(f)
/**
- * Receives a message from the mailbox of
- * <code>self</code>. Blocks at most <code>msec</code>
- * milliseconds if no message matching any of the cases of
- * <code>f</code> can be received. If no message could be
- * received the <code>TIMEOUT</code> action is executed if
- * specified.
+ * Receives a message from the mailbox of `self`. Blocks at most `msec`
+ * milliseconds if no message matching any of the cases of `f` can be
+ * received. If no message could be received the `TIMEOUT` action is
+ * executed if specified.
*
* @param msec the time span before timeout
* @param f a partial function specifying patterns and actions
@@ -208,11 +198,10 @@ object Actor extends Combinators {
self.receiveWithin(msec)(f)
/**
- * Lightweight variant of <code>receive</code>.
+ * Lightweight variant of `receive`.
*
- * Actions in <code>f</code> have to contain the rest of the
- * computation of <code>self</code>, as this method will never
- * return.
+ * Actions in `f` have to contain the rest of the computation of `self`,
+ * as this method will never return.
*
* A common method of continuting the computation is to send a message
* to another actor:
@@ -241,11 +230,10 @@ object Actor extends Combinators {
rawSelf.react(f)
/**
- * Lightweight variant of <code>receiveWithin</code>.
+ * Lightweight variant of `receiveWithin`.
*
- * Actions in <code>f</code> have to contain the rest of the
- * computation of <code>self</code>, as this method will never
- * return.
+ * Actions in `f` have to contain the rest of the computation of `self`,
+ * as this method will never return.
*
* @param msec the time span before timeout
* @param f a partial function specifying patterns and actions
@@ -274,23 +262,21 @@ object Actor extends Combinators {
rawSelf.sender
/**
- * Sends <code>msg</code> to the actor waiting in a call to
- * <code>!?</code>.
+ * Sends `msg` to the actor waiting in a call to `!?`.
*/
def reply(msg: Any): Unit =
rawSelf.reply(msg)
/**
- * Sends <code>()</code> to the actor waiting in a call to
- * <code>!?</code>.
+ * Sends `()` to the actor waiting in a call to `!?`.
*/
def reply(): Unit =
rawSelf.reply(())
/**
- * Returns the number of messages in <code>self</code>'s mailbox
+ * Returns the number of messages in `self`'s mailbox
*
- * @return the number of messages in <code>self</code>'s mailbox
+ * @return the number of messages in `self`'s mailbox
*/
def mailboxSize: Int = rawSelf.mailboxSize
@@ -321,7 +307,7 @@ object Actor extends Combinators {
}
/**
- * Links <code>self</code> to actor <code>to</code>.
+ * Links `self` to actor `to`.
*
* @param to the actor to link to
* @return the parameter actor
@@ -329,7 +315,7 @@ object Actor extends Combinators {
def link(to: AbstractActor): AbstractActor = self.link(to)
/**
- * Links <code>self</code> to the actor defined by <code>body</code>.
+ * Links `self` to the actor defined by `body`.
*
* @param body the body of the actor to link to
* @return the parameter actor
@@ -337,107 +323,78 @@ object Actor extends Combinators {
def link(body: => Unit): Actor = self.link(body)
/**
- * Unlinks <code>self</code> from actor <code>from</code>.
+ * Unlinks `self` from actor `from`.
*
* @param from the actor to unlink from
*/
def unlink(from: AbstractActor): Unit = self.unlink(from)
/**
- * <p>
- * Terminates execution of <code>self</code> with the following
- * effect on linked actors:
- * </p>
- * <p>
- * For each linked actor <code>a</code> with
- * <code>trapExit</code> set to <code>true</code>, send message
- * <code>Exit(self, reason)</code> to <code>a</code>.
- * </p>
- * <p>
- * For each linked actor <code>a</code> with
- * <code>trapExit</code> set to <code>false</code> (default),
- * call <code>a.exit(reason)</code> if
- * <code>reason != 'normal</code>.
- * </p>
+ * Terminates execution of `self` with the following effect on
+ * linked actors:
+ *
+ * For each linked actor `a` with `trapExit` set to `'''true'''`,
+ * send message `Exit(self, reason)` to `a`.
+ *
+ * For each linked actor `a` with `trapExit` set to `'''false'''`
+ * (default), call `a.exit(reason)` if `reason != 'normal`.
*/
def exit(reason: AnyRef): Nothing = self.exit(reason)
/**
- * <p>
- * Terminates execution of <code>self</code> with the following
- * effect on linked actors:
- * </p>
- * <p>
- * For each linked actor <code>a</code> with
- * <code>trapExit</code> set to <code>true</code>, send message
- * <code>Exit(self, 'normal)</code> to <code>a</code>.
- * </p>
+ * Terminates execution of `self` with the following effect on
+ * linked actors:
+ *
+ * For each linked actor `a` with `trapExit` set to `'''true'''`,
+ * send message `Exit(self, 'normal)` to `a`.
*/
def exit(): Nothing = rawSelf.exit()
}
-/**
- * <p>
- * Provides lightweight, concurrent actors. Actors are
- * created by extending the `Actor` trait (alternatively, one of the
- * factory methods in its companion object can be used). The
- * behavior of an `Actor` subclass is defined by implementing its
- * `act` method:
- *
- * {{{
- * class MyActor extends Actor {
- * def act() {
- * // actor behavior goes here
- * }
- * }
- * }}}
+/** Provides lightweight, concurrent actors. Actors are created by extending
+ * the `Actor` trait (alternatively, one of the factory methods in its
+ * companion object can be used). The behavior of an `Actor` subclass is
+ * defined by implementing its `act` method:
+ * {{{
+ * class MyActor extends Actor {
+ * def act() {
+ * // actor behavior goes here
+ * }
+ * }
+ * }}}
+ * A new `Actor` instance is started by invoking its `start` method.
*
- * A new `Actor` instance is started by invoking its `start` method.
+ * '''Note:''' care must be taken when invoking thread-blocking methods other
+ * than those provided by the `Actor` trait or its companion object (such as
+ * `receive`). Blocking the underlying thread inside an actor may lead to
+ * starvation of other actors. This also applies to actors hogging their
+ * thread for a long time between invoking `receive`/`react`.
*
- * '''Note:''' care must be taken when invoking thread-blocking methods
- * other than those provided by the `Actor` trait or its companion
- * object (such as `receive`). Blocking the underlying thread inside
- * an actor may lead to starvation of other actors. This also
- * applies to actors hogging their thread for a long time between
- * invoking `receive`/`react`.
+ * If actors use blocking operations (for example, methods for blocking I/O),
+ * there are several options:
*
- * If actors use blocking operations (for example, methods for
- * blocking I/O), there are several options:
- * <ul>
- * <li>The run-time system can be configured to use a larger thread pool size
- * (for example, by setting the `actors.corePoolSize` JVM property).</li>
+ * - The run-time system can be configured to use a larger thread pool size
+ * (for example, by setting the `actors.corePoolSize` JVM property).
+ * - The `scheduler` method of the `Actor` trait can be overridden to return a
+ * `ResizableThreadPoolScheduler`, which resizes its thread pool to
+ * avoid starvation caused by actors that invoke arbitrary blocking methods.
+ * - The `actors.enableForkJoin` JVM property can be set to `false`, in which
+ * case a `ResizableThreadPoolScheduler` is used by default to execute actors.
*
- * <li>The `scheduler` method of the `Actor` trait can be overridden to return a
- * `ResizableThreadPoolScheduler`, which resizes its thread pool to
- * avoid starvation caused by actors that invoke arbitrary blocking methods.</li>
+ * The main ideas of the implementation are explained in the two papers
*
- * <li>The `actors.enableForkJoin` JVM property can be set to `false`, in which
- * case a `ResizableThreadPoolScheduler` is used by default to execute actors.</li>
- * </ul>
- * </p>
- * <p>
- * The main ideas of the implementation are explained in the two papers
- * <ul>
- * <li>
- * <a href="http://lampwww.epfl.ch/~odersky/papers/jmlc06.pdf">
- * <span style="font-weight:bold; white-space:nowrap;">Event-Based
- * Programming without Inversion of Control</span></a>,
- * Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i>, and
- * </li>
- * <li>
- * <a href="http://lamp.epfl.ch/~phaller/doc/haller07coord.pdf">
- * <span style="font-weight:bold; white-space:nowrap;">Actors that
- * Unify Threads and Events</span></a>,
- * Philipp Haller and Martin Odersky, <i>Proc. COORDINATION 2007</i>.
- * </li>
- * </ul>
- * </p>
+ * - [[http://lampwww.epfl.ch/~odersky/papers/jmlc06.pdf Event-Based
+ * Programming without Inversion of Control]],
+ * Philipp Haller and Martin Odersky, ''Proc. JMLC 2006'', and
+ * - [[http://lamp.epfl.ch/~phaller/doc/haller07coord.pdf Actors that
+ * Unify Threads and Events]],
+ * Philipp Haller and Martin Odersky, ''Proc. COORDINATION 2007''.
*
- * @author Philipp Haller
+ * @author Philipp Haller
*
- * @define actor actor
- * @define channel actor's mailbox
+ * @define actor actor
+ * @define channel actor's mailbox
*/
@SerialVersionUID(-781154067877019505L)
trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with InputChannel[Any] with Serializable {
@@ -729,7 +686,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
private[actors] var links: List[AbstractActor] = Nil
/**
- * Links <code>self</code> to actor <code>to</code>.
+ * Links `self` to actor `to`.
*
* @param to the actor to link to
* @return the parameter actor
@@ -742,7 +699,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
- * Links <code>self</code> to the actor defined by <code>body</code>.
+ * Links `self` to the actor defined by `body`.
*
* @param body the body of the actor to link to
* @return the parameter actor
@@ -763,7 +720,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
- * Unlinks <code>self</code> from actor <code>from</code>.
+ * Unlinks `self` from actor `from`.
*/
def unlink(from: AbstractActor) {
assert(Actor.self(scheduler) == this, "unlink called on actor different from self")
@@ -783,21 +740,14 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
private[actors] var shouldExit = false
/**
- * <p>
- * Terminates execution of <code>self</code> with the following
- * effect on linked actors:
- * </p>
- * <p>
- * For each linked actor <code>a</code> with
- * <code>trapExit</code> set to <code>true</code>, send message
- * <code>Exit(self, reason)</code> to <code>a</code>.
- * </p>
- * <p>
- * For each linked actor <code>a</code> with
- * <code>trapExit</code> set to <code>false</code> (default),
- * call <code>a.exit(reason)</code> if
- * <code>reason != 'normal</code>.
- * </p>
+ * Terminates execution of `self` with the following effect on
+ * linked actors:
+ *
+ * For each linked actor `a` with `trapExit` set to `'''true'''`,
+ * send message `Exit(self, reason)` to `a`.
+ *
+ * For each linked actor `a` with `trapExit` set to `'''false'''`
+ * (default), call `a.exit(reason)` if `reason != 'normal`.
*/
protected[actors] def exit(reason: AnyRef): Nothing = {
synchronized {
@@ -807,7 +757,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
/**
- * Terminates with exit reason <code>'normal</code>.
+ * Terminates with exit reason `'normal`.
*/
protected[actors] override def exit(): Nothing = {
val todo = synchronized {
@@ -879,7 +829,7 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
}
}
- /* Requires qualified private, because <code>RemoteActor</code> must
+ /** Requires qualified private, because `RemoteActor` must
* register a termination handler.
*/
private[actors] def onTerminate(f: => Unit) {
@@ -907,9 +857,8 @@ trait Actor extends AbstractActor with ReplyReactor with ActorCanReply with Inpu
case object TIMEOUT
-/** Sent to an actor
- * with `trapExit` set to `true` whenever one of its linked actors
- * terminates.
+/** Sent to an actor with `trapExit` set to `'''true'''` whenever one of its
+ * linked actors terminates.
*
* @param from the actor that terminated
* @param reason the reason that caused the actor to terminate
diff --git a/src/actors/scala/actors/ActorProxy.scala b/src/actors/scala/actors/ActorProxy.scala
index d4381ab706..d18e28bea3 100644
--- a/src/actors/scala/actors/ActorProxy.scala
+++ b/src/actors/scala/actors/ActorProxy.scala
@@ -12,8 +12,7 @@ package scala.actors
import java.lang.Thread
/**
- * Provides a dynamic actor proxy for normal
- * Java threads.
+ * Provides a dynamic actor proxy for normal Java threads.
*
* @author Philipp Haller
*/
@@ -22,7 +21,7 @@ private[actors] class ActorProxy(t: Thread, override final val scheduler: ISched
def act() {}
/**
- * Terminates with exit reason <code>'normal</code>.
+ * Terminates with exit reason `'normal`.
*/
override def exit(): Nothing = {
shouldExit = false
diff --git a/src/actors/scala/actors/CanReply.scala b/src/actors/scala/actors/CanReply.scala
index de2c91d747..5053f43e94 100644
--- a/src/actors/scala/actors/CanReply.scala
+++ b/src/actors/scala/actors/CanReply.scala
@@ -21,8 +21,7 @@ trait CanReply[-T, +R] {
type Future[+P] <: () => P
/**
- * Sends <code>msg</code> to this $actor and
- * awaits reply (synchronous).
+ * Sends `msg` to this $actor and awaits reply (synchronous).
*
* @param msg the message to be sent
* @return the reply
@@ -30,20 +29,19 @@ trait CanReply[-T, +R] {
def !?(msg: T): R
/**
- * Sends <code>msg</code> to this $actor and
- * awaits reply (synchronous) within <code>msec</code>
- * milliseconds.
+ * Sends `msg` to this $actor and awaits reply (synchronous) within
+ * `msec` milliseconds.
*
* @param msec the time span before timeout
* @param msg the message to be sent
- * @return <code>None</code> in case of timeout, otherwise
- * <code>Some(x)</code> where <code>x</code> is the reply
+ * @return `None` in case of timeout, otherwise
+ * `Some(x)` where `x` is the reply
*/
def !?(msec: Long, msg: T): Option[R]
/**
- * Sends <code>msg</code> to this $actor and
- * immediately returns a future representing the reply value.
+ * Sends `msg` to this $actor and immediately returns a future representing
+ * the reply value.
*
* @param msg the message to be sent
* @return the future
@@ -51,11 +49,10 @@ trait CanReply[-T, +R] {
def !!(msg: T): Future[R]
/**
- * Sends <code>msg</code> to this $actor and
- * immediately returns a future representing the reply value.
- * The reply is post-processed using the partial function
- * <code>handler</code>. This also allows to recover a more
- * precise type for the reply value.
+ * Sends `msg` to this $actor and immediately returns a future representing
+ * the reply value. The reply is post-processed using the partial function
+ * `handler`. This also allows to recover a more precise type for the reply
+ * value.
*
* @param msg the message to be sent
* @param handler the function to be applied to the response
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala
index f4898775fc..62331239e8 100644
--- a/src/actors/scala/actors/Channel.scala
+++ b/src/actors/scala/actors/Channel.scala
@@ -6,15 +6,13 @@
** |/ **
\* */
-
package scala.actors
import scala.concurrent.SyncVar
/**
- * Used to pattern match on values that were sent
- * to some channel <code>Chan<sub>n</sub></code> by the current
- * actor <code>self</code>.
+ * Used to pattern match on values that were sent to some channel `Chan,,n,,`
+ * by the current actor `self`.
*
* @example {{{
* receive {
@@ -28,9 +26,8 @@ import scala.concurrent.SyncVar
case class ! [a](ch: Channel[a], msg: a)
/**
- * Provides a means for typed communication among
- * actors. Only the actor creating an instance of a
- * <code>Channel</code> may receive from it.
+ * Provides a means for typed communication among actors. Only the
+ * actor creating an instance of a `Channel` may receive from it.
*
* @author Philipp Haller
*
diff --git a/src/actors/scala/actors/DaemonActor.scala b/src/actors/scala/actors/DaemonActor.scala
index ad26bab652..48256106bd 100644
--- a/src/actors/scala/actors/DaemonActor.scala
+++ b/src/actors/scala/actors/DaemonActor.scala
@@ -12,8 +12,9 @@ import scheduler.DaemonScheduler
/**
* Base trait for actors with daemon semantics.
- * Unlike a regular <code>Actor</code>, an active <code>DaemonActor</code> will
- * not prevent an application terminating, much like a daemon thread.
+ *
+ * Unlike a regular `Actor`, an active `DaemonActor` will not
+ * prevent an application terminating, much like a daemon thread.
*
* @author Erik Engbrecht
*/
diff --git a/src/actors/scala/actors/IScheduler.scala b/src/actors/scala/actors/IScheduler.scala
index 2bb90a5fa7..bf108133e2 100644
--- a/src/actors/scala/actors/IScheduler.scala
+++ b/src/actors/scala/actors/IScheduler.scala
@@ -10,12 +10,10 @@
package scala.actors
/**
- * A common interface
- * for all schedulers used to execute actor tasks.
+ * A common interface for all schedulers used to execute actor tasks.
*
- * Subclasses of <code>Actor</code> that override its
- * <code>scheduler</code> member must provide
- * an <code>IScheduler</code> implementation.
+ * Subclasses of `Actor` that override its `scheduler` member must provide
+ * an `IScheduler` implementation.
*
* @author Philipp Haller
*/
@@ -27,7 +25,7 @@ trait IScheduler {
*/
def execute(fun: => Unit): Unit
- /** Submits a <code>Runnable</code> for execution.
+ /** Submits a `Runnable` for execution.
*
* @param task the task to be executed
*/
diff --git a/src/actors/scala/actors/MessageQueue.scala b/src/actors/scala/actors/MessageQueue.scala
index 777735df23..e96f3d787f 100644
--- a/src/actors/scala/actors/MessageQueue.scala
+++ b/src/actors/scala/actors/MessageQueue.scala
@@ -6,12 +6,10 @@
** |/ **
\* */
-
package scala.actors
/**
- * This class is used by our efficient message queue
- * implementation.
+ * This class is used by our efficient message queue implementation.
*
* @author Philipp Haller
*/
@@ -28,10 +26,9 @@ private[actors] class MQueueElement[Msg >: Null](val msg: Msg, val session: Outp
}
/**
- * The class <code>MessageQueue</code> provides an efficient
- * implementation of a message queue specialized for this actor
- * library. Classes in this package are supposed to be the only
- * clients of this class.
+ * The class `MessageQueue` provides an efficient implementation of a message
+ * queue specialized for this actor library. Classes in this package are
+ * supposed to be the only clients of this class.
*
* @author Philipp Haller
*/
@@ -107,7 +104,7 @@ private[actors] class MQueue[Msg >: Null](protected val label: String) {
acc
}
- /** Returns the n-th message that satisfies the predicate <code>p</code>
+ /** Returns the n-th message that satisfies the predicate `p`
* without removing it.
*/
def get(n: Int)(p: Msg => Boolean): Option[Msg] = {
@@ -129,8 +126,8 @@ private[actors] class MQueue[Msg >: Null](protected val label: String) {
def remove(n: Int)(p: (Msg, OutputChannel[Any]) => Boolean): Option[(Msg, OutputChannel[Any])] =
removeInternal(n)(p) map (x => (x.msg, x.session))
- /** Extracts the first message that satisfies the predicate <code>p</code>
- * or <code>null</code> if <code>p</code> fails for all of them.
+ /** Extracts the first message that satisfies the predicate `p`
+ * or `'''null'''` if `p` fails for all of them.
*/
def extractFirst(p: (Msg, OutputChannel[Any]) => Boolean): MQueueElement[Msg] =
removeInternal(0)(p) orNull
diff --git a/src/actors/scala/actors/OutputChannel.scala b/src/actors/scala/actors/OutputChannel.scala
index 35a95c3762..089b3d0981 100644
--- a/src/actors/scala/actors/OutputChannel.scala
+++ b/src/actors/scala/actors/OutputChannel.scala
@@ -6,7 +6,6 @@
** |/ **
\* */
-
package scala.actors
/**
@@ -19,14 +18,14 @@ package scala.actors
trait OutputChannel[-Msg] {
/**
- * Sends <code>msg</code> to this $actor (asynchronous).
+ * Sends `msg` to this $actor (asynchronous).
*
* @param msg the message to send
*/
def !(msg: Msg): Unit
/**
- * Sends <code>msg</code> to this $actor (asynchronous) supplying
+ * Sends `msg` to this $actor (asynchronous) supplying
* explicit reply destination.
*
* @param msg the message to send
@@ -35,14 +34,14 @@ trait OutputChannel[-Msg] {
def send(msg: Msg, replyTo: OutputChannel[Any]): Unit
/**
- * Forwards <code>msg</code> to this $actor (asynchronous).
+ * Forwards `msg` to this $actor (asynchronous).
*
* @param msg the message to forward
*/
def forward(msg: Msg): Unit
/**
- * Returns the <code>Actor</code> that is receiving from this $actor.
+ * Returns the `Actor` that is receiving from this $actor.
*/
def receiver: Actor
}
diff --git a/src/actors/scala/actors/ReactChannel.scala b/src/actors/scala/actors/ReactChannel.scala
index 9b6c1c5c77..fccde34272 100644
--- a/src/actors/scala/actors/ReactChannel.scala
+++ b/src/actors/scala/actors/ReactChannel.scala
@@ -26,8 +26,8 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Sends a message to this <code>ReactChannel</code>
- * (asynchronous) supplying explicit reply destination.
+ * Sends a message to this `ReactChannel` (asynchronous) supplying
+ * explicit reply destination.
*
* @param msg the message to send
* @param replyTo the reply destination
@@ -37,17 +37,17 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Forwards <code>msg</code> to <code>this</code> keeping the
- * last sender as sender instead of <code>self</code>.
+ * Forwards `msg` to `'''this'''` keeping the last sender as sender
+ * instead of `self`.
*/
def forward(msg: Msg) {
receiver forward SendToReactor(this, msg)
}
/**
- * Receives a message from this <code>ReactChannel</code>.
- * <p>
- * This method never returns. Therefore, the rest of the computation
+ * Receives a message from this `ReactChannel`.
+ *
+ * This method ''never'' returns. Therefore, the rest of the computation
* has to be contained in the actions of the partial function.
*
* @param f a partial function with message patterns and actions
@@ -61,10 +61,9 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Receives a message from this <code>ReactChannel</code> within
- * a certain time span.
- * <p>
- * This method never returns. Therefore, the rest of the computation
+ * Receives a message from this `ReactChannel` within a certain time span.
+ *
+ * This method ''never'' returns. Therefore, the rest of the computation
* has to be contained in the actions of the partial function.
*
* @param msec the time span before timeout
@@ -81,7 +80,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Receives a message from this <code>ReactChannel</code>.
+ * Receives a message from this `ReactChannel`.
*
* @param f a partial function with message patterns and actions
* @return result of processing the received value
@@ -96,8 +95,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Receives a message from this <code>ReactChannel</code> within a certain
- * time span.
+ * Receives a message from this `ReactChannel` within a certain time span.
*
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
@@ -114,7 +112,7 @@ private[actors] class ReactChannel[Msg](receiver: ReplyReactor) extends InputCha
}
/**
- * Receives the next message from this <code>ReactChannel</code>.
+ * Receives the next message from this `ReactChannel`.
*/
def ? : Msg = receive {
case x => x
diff --git a/src/actors/scala/actors/ReplyReactor.scala b/src/actors/scala/actors/ReplyReactor.scala
index 85ef0d38d3..0e5ce00c91 100644
--- a/src/actors/scala/actors/ReplyReactor.scala
+++ b/src/actors/scala/actors/ReplyReactor.scala
@@ -6,16 +6,16 @@
** |/ **
\* */
-
package scala.actors
import java.util.{Timer, TimerTask}
/**
- * Extends the [[scala.actors.Reactor]]
- * trait with methods to reply to the sender of a message.
- * Sending a message to a <code>ReplyReactor</code> implicitly
- * passes a reference to the sender together with the message.
+ * Extends the [[scala.actors.Reactor]] trait with methods to reply to the
+ * sender of a message.
+ *
+ * Sending a message to a `ReplyReactor` implicitly passes a reference to
+ * the sender together with the message.
*
* @author Philipp Haller
*
@@ -43,7 +43,7 @@ trait ReplyReactor extends Reactor[Any] with ReactorCanReply {
protected[actors] def sender: OutputChannel[Any] = senders.head
/**
- * Replies with <code>msg</code> to the sender.
+ * Replies with `msg` to the sender.
*/
protected[actors] def reply(msg: Any) {
sender ! msg
diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala
index 7fe492cae2..0729ff5bc8 100644
--- a/src/actors/scala/actors/Scheduler.scala
+++ b/src/actors/scala/actors/Scheduler.scala
@@ -38,7 +38,7 @@ object Scheduler extends DelegatingScheduler {
sched
}
- /* Only <code>ForkJoinScheduler</code> implements this method.
+ /* Only `ForkJoinScheduler` implements this method.
*/
@deprecated("snapshot will be removed", "2.8.0")
def snapshot() {
@@ -48,7 +48,7 @@ object Scheduler extends DelegatingScheduler {
sys.error("scheduler does not implement snapshot")
}
- /* Only <code>ForkJoinScheduler</code> implements this method.
+ /* Only `ForkJoinScheduler` implements this method.
*/
@deprecated("restart will be removed", "2.8.0")
def restart() {
diff --git a/src/actors/scala/actors/remote/TcpService.scala b/src/actors/scala/actors/remote/TcpService.scala
index be34e93cdd..9d86a97f2d 100644
--- a/src/actors/scala/actors/remote/TcpService.scala
+++ b/src/actors/scala/actors/remote/TcpService.scala
@@ -77,7 +77,7 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service {
/**
* Sends a byte array to another node on the network.
- * If the node is not yet up, up to <code>TcpService.BufSize</code>
+ * If the node is not yet up, up to `TcpService.BufSize`
* messages are buffered.
*/
def send(node: Node, data: Array[Byte]): Unit = synchronized {
diff --git a/src/actors/scala/actors/scheduler/ActorGC.scala b/src/actors/scala/actors/scheduler/ActorGC.scala
index 41ec401dbf..e1eaf86607 100644
--- a/src/actors/scala/actors/scheduler/ActorGC.scala
+++ b/src/actors/scala/actors/scheduler/ActorGC.scala
@@ -19,9 +19,9 @@ import scala.collection.mutable
* either been explicitly terminated or garbage collected.
*
* When an actor is started, it is registered with the ActorGC via the
- * <code>newActor</code> method, and when an actor is knowingly terminated
+ * `newActor` method, and when an actor is knowingly terminated
* (e.g. act method finishes, exit explicitly called, an exception is thrown),
- * the ActorGC is informed via the <code>terminated</code> method.
+ * the ActorGC is informed via the `terminated` method.
*/
trait ActorGC extends TerminationMonitor {
self: IScheduler =>
@@ -31,8 +31,8 @@ trait ActorGC extends TerminationMonitor {
/**
* This is a set of references to all the actors registered with
- * this ActorGC. It is maintained so that the WeakReferences will not be GC'd
- * before the actors to which they point.
+ * this ActorGC. It is maintained so that the WeakReferences will
+ * not be GC'd before the actors to which they point.
*/
private val refSet = new mutable.HashSet[Reference[t] forSome { type t <: TrackedReactor }]
diff --git a/src/actors/scala/actors/scheduler/QuitControl.scala b/src/actors/scala/actors/scheduler/QuitControl.scala
index 9560a0e8b8..935e2a8e11 100644
--- a/src/actors/scala/actors/scheduler/QuitControl.scala
+++ b/src/actors/scala/actors/scheduler/QuitControl.scala
@@ -11,8 +11,8 @@ package scala.actors.scheduler
import scala.util.control.ControlThrowable
/**
- * The <code>QuitControl</code> class is used to manage control flow
- * of certain schedulers.
+ * The `QuitControl` class is used to manage control flow of certain
+ * schedulers.
*
* @author Philipp Haller
*/
diff --git a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala
index f6c14e3462..2429fe749e 100644
--- a/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala
+++ b/src/actors/scala/actors/scheduler/ResizableThreadPoolScheduler.scala
@@ -6,7 +6,6 @@
** |/ **
\* */
-
package scala.actors.scheduler
import scala.actors.threadpool.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue,
@@ -15,13 +14,11 @@ import scala.actors.{Debug, IScheduler}
import scala.concurrent.ManagedBlocker
/**
- * This scheduler class uses a <code>ThreadPoolExecutor</code>
- * to execute <code>Actor</code>s.
+ * This scheduler class uses a `ThreadPoolExecutor` to execute `Actor`s.
*
* The scheduler attempts to shut down itself and the underlying
- * <code>ThreadPoolExecutor</code> only if <code>terminate</code>
- * is set to true. Otherwise, the scheduler must be shut down
- * explicitly.
+ * `ThreadPoolExecutor` only if `terminate` is set to true. Otherwise,
+ * the scheduler must be shut down explicitly.
*
* @author Philipp Haller
*/
@@ -176,7 +173,7 @@ class ResizableThreadPoolScheduler(protected val terminate: Boolean,
}
/** Resumes the execution of the scheduler if it was previously
- * suspended using <code>snapshot</code>.
+ * suspended using `snapshot`.
*/
def restart() {
synchronized {