dk.brics.xact.analysis.concurrent
Class SingleThreadedTaskRunner

java.lang.Object
  extended by dk.brics.xact.analysis.concurrent.SingleThreadedTaskRunner
All Implemented Interfaces:
XactTaskRunner

public class SingleThreadedTaskRunner
extends Object
implements XactTaskRunner

Runs all tasks in the calling thread.


Constructor Summary
SingleThreadedTaskRunner()
           
 
Method Summary
 void addTask(Runnable runnable)
          Adds a tasks to the task scheduler.
 boolean maybeMultiThreaded()
          Returns true if the scheduler might be multithreaded, or false if it is definitely not multithreaded.
 void runTasks()
          Runs all scheduled tasks and returns when all have completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleThreadedTaskRunner

public SingleThreadedTaskRunner()
Method Detail

addTask

public void addTask(Runnable runnable)
Description copied from interface: XactTaskRunner
Adds a tasks to the task scheduler. The task will not be run until the next invocation of XactTaskRunner.runTasks().

Specified by:
addTask in interface XactTaskRunner
Parameters:
runnable - the task to be executed

maybeMultiThreaded

public boolean maybeMultiThreaded()
Description copied from interface: XactTaskRunner
Returns true if the scheduler might be multithreaded, or false if it is definitely not multithreaded.

If not multithreaded, the analysis can occasionally skip certain tasks that only exist to avoid interference.

Specified by:
maybeMultiThreaded in interface XactTaskRunner
Returns:
false if definitely single-threaded, otherwise true

runTasks

public void runTasks()
Description copied from interface: XactTaskRunner
Runs all scheduled tasks and returns when all have completed. The queue of tasks is cleared after this.

Throws a runtime exception if any of the tasks terminated with an unhandled exception.

Specified by:
runTasks in interface XactTaskRunner


Copyright © 2005-2011 Aarhus University.