pt.ua.concurrent
Class Actor

java.lang.Object
  extended by java.lang.Thread
      extended by pt.ua.concurrent.Actor
All Implemented Interfaces:
java.lang.Runnable

public class Actor
extends java.lang.Thread

An actor module (object-oriented approach for message passing concurrent programming).

This class implements, in an object-oriented way, the message passing thread communication mechanism.
Important Note: external synchronization is not yet implemented.

This class follows DbC(tm) methodology (Wikipedia). Where possible, contracts are implement with native's Java assert.

Version:
0.5, November 2011, 0.6, November 2012
Author:
Miguel Oliveira e Silva (mos@ua.pt)

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Actor()
          Constructs a new Actor (note that its attached thread is not started here).
 
Method Summary
 void run()
          The actor's message handling routine.
 void terminate()
          Terminate te execution of actor.
 boolean terminated()
          Is the actor terminated?
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Actor

public Actor()
Constructs a new Actor (note that its attached thread is not started here).

Method Detail

terminate

public void terminate()
Terminate te execution of actor. The actor will terminate as soon as its pending queue is empty.

requires: isAlive()


terminated

public boolean terminated()
Is the actor terminated?

Returns:
boolean true if the actor has finished, false otherwise

run

public void run()
The actor's message handling routine. (This method is to be executed only by thread's start method.)

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread