scala.actors

trait Actor

[source: scala/actors/Actor.scala]

trait Actor
extends OutputChannel[Any]

This class provides (together with Channel) an implementation of event-based actors.

The main ideas of our approach are explained in the two papers

Version
0.9.7
Author
Philipp Haller
Direct Known Subclasses:
ActorProxy

Value Summary
var continuation : PartialFunction[Any, Unit]
var exitReason : AnyRef
var exiting : Boolean
var isDetached : Boolean
var isSuspended : Boolean
var isWaiting : Boolean
var kill : () => Unit
var links : List[Actor]
var sessions : List[Channel[Any]]
var shouldExit : Boolean
var timeoutPending : Boolean
var trapExit : Boolean
var waitingFor : (Any) => Boolean
val waitingForNone : (Any) => Boolean
Method Summary
def ! (msg : Any) : Unit
Sends msg to this actor (asynchronous).
def !! (msg : Any) : Future[Any]
Sends msg to this actor and immediately returns a future representing the reply value.
def !! [a](msg : Any, f : PartialFunction[Any, a]) : Future[a]
Sends msg to this actor and immediately returns a future representing the reply value. The reply is post-processed using the partial function f. This also allows to recover a more precise type for the reply value.
def !? (msec : Long, msg : Any) : Option[Any]
Sends msg to this actor and awaits reply (synchronous) within msec milliseconds. When the timeout occurs, None is returned. Otherwise, returns Some(value) where value is the reply value.
def !? (msg : Any) : Any
Sends msg to this actor and awaits reply (synchronous).
def ? : Any
Receives the next message from this actor's mailbox.
abstract def act : Unit
The behavior of an actor is specified by implementing this abstract method. Note that the preferred way to create actors is through the actor method defined in object Actor.
def exit (from : Actor, reason : AnyRef) : Unit
def exit (reason : AnyRef) : Nothing

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 : Nothing
Terminates with exit reason 'normal.
def exitLinked (reason : AnyRef) : Unit
def exitLinked : Unit
def forward (msg : Any) : Unit
Forwards msg to this actor (asynchronous).
def freshReply : Channel[Any]
def getReplyChannel : Channel[Any]
def link (body : => Unit) : Actor
Links self to actor defined by body.
def link (to : Actor) : Actor
Links self to actor to.
def linkTo (to : Actor) : Unit
def react (f : PartialFunction[Any, Unit]) : Nothing
def reactWithin (msec : Long)(f : PartialFunction[Any, Unit]) : Nothing
def receive [R](f : PartialFunction[Any, R]) : R
def receiveWithin [R](msec : Long)(f : PartialFunction[Any, R]) : R
def reply (msg : Any) : Unit
Replies with msg to the sender waiting in a synchronous send.
def resumeActor : Unit
def scheduleActor (f : PartialFunction[Any, Unit], msg : Any) : Unit
def sender : Actor
def session : Channel[Any]
def start : Actor
Starts this actor.
def suspendActor : Unit
def suspendActorFor (msec : Long) : Unit
def tick : Unit
def unlink (from : Actor) : Unit
Unlinks self from actor from.
def unlinkFrom (from : Actor) : Unit
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
val waitingForNone : (Any) => Boolean

var waitingFor : (Any) => Boolean

var isSuspended : Boolean

var sessions : List[Channel[Any]]

var continuation : PartialFunction[Any, Unit]

var timeoutPending : Boolean

var isDetached : Boolean

var isWaiting : Boolean

var kill : () => Unit

var links : List[Actor]

var trapExit : Boolean

var exitReason : AnyRef

var exiting : Boolean

var shouldExit : Boolean

Method Details
def receive[R](f : PartialFunction[Any, R]) : R

def receiveWithin[R](msec : Long)(f : PartialFunction[Any, R]) : R

def react(f : PartialFunction[Any, Unit]) : Nothing

def reactWithin(msec : Long)(f : PartialFunction[Any, Unit]) : Nothing

abstract def act : Unit
The behavior of an actor is specified by implementing this abstract method. Note that the preferred way to create actors is through the actor method defined in object Actor.

def !(msg : Any) : Unit
Sends msg to this actor (asynchronous).
Overrides
OutputChannel.!

def forward(msg : Any) : Unit
Forwards msg to this actor (asynchronous).
Overrides
OutputChannel.forward

def !?(msg : Any) : Any
Sends msg to this actor and awaits reply (synchronous).

def !?(msec : Long, msg : Any) : Option[Any]
Sends msg to this actor and awaits reply (synchronous) within msec milliseconds. When the timeout occurs, None is returned. Otherwise, returns Some(value) where value is the reply value.

def !!(msg : Any) : Future[Any]
Sends msg to this actor and immediately returns a future representing the reply value.

def !![a](msg : Any, f : PartialFunction[Any, a]) : Future[a]
Sends msg to this actor and immediately returns a future representing the reply value. The reply is post-processed using the partial function f. This also allows to recover a more precise type for the reply value.

def reply(msg : Any) : Unit
Replies with msg to the sender waiting in a synchronous send.

def getReplyChannel : Channel[Any]

def freshReply : Channel[Any]

def ? : Any
Receives the next message from this actor's mailbox.

def sender : Actor

def session : Channel[Any]

def scheduleActor(f : PartialFunction[Any, Unit], msg : Any) : Unit

def tick : Unit

def suspendActor : Unit

def suspendActorFor(msec : Long) : Unit

def resumeActor : Unit

def start : Actor
Starts this actor.

def link(to : Actor) : Actor
Links self to actor to.
Parameters
to - ...
Returns
...

def link(body : => Unit) : Actor
Links self to actor defined by body.

def linkTo(to : Actor) : Unit

def unlink(from : Actor) : Unit
Unlinks self from actor from.

def unlinkFrom(from : Actor) : Unit

def exit(reason : AnyRef) : Nothing

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 : Nothing
Terminates with exit reason 'normal.

def exitLinked : Unit

def exitLinked(reason : AnyRef) : Unit

def exit(from : Actor, reason : AnyRef) : Unit