Trull

edu.luc.cs.trull
Class FastScheduler

java.lang.Object
  extended by edu.luc.cs.trull.FastScheduler
All Implemented Interfaces:
Scheduler
Direct Known Subclasses:
DefaultScheduler

 class FastScheduler
extends java.lang.Object
implements Scheduler

An implementation of the Scheduler interface based on Doug Lea's QueuedExecutor. To allow for faster execution, this class does not support the await method.


Nested Class Summary
protected  class FastScheduler.WaitableRunnable
          A wrapper around a Runnable that releases a latch when the Runnable has finished.
 
Field Summary
protected  EDU.oswego.cs.dl.util.concurrent.QueuedExecutor executor
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
FastScheduler()
          Sole constructor.
 
Method Summary
 void await()
          This method is not supported in the interest of faster execution.
 void execute(java.lang.Runnable task)
          This method executes a Runnable and waits for its completion.
protected  java.lang.Runnable makeWaitable(java.lang.Runnable task, EDU.oswego.cs.dl.util.concurrent.Latch done)
          Factory method for a Runnable to schedule.
 void schedule(java.lang.Runnable task)
          This method schedules a Runnable for later execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

executor

protected EDU.oswego.cs.dl.util.concurrent.QueuedExecutor executor

logger

private static final org.apache.log4j.Logger logger
Constructor Detail

FastScheduler

public FastScheduler()
Sole constructor.

Method Detail

await

public void await()
           throws java.lang.InterruptedException
This method is not supported in the interest of faster execution.

Specified by:
await in interface Scheduler
Throws:
java.lang.InterruptedException - if the current thread is interrupted while waiting.

execute

public void execute(java.lang.Runnable task)
             throws java.lang.InterruptedException
Description copied from interface: Scheduler
This method executes a Runnable and waits for its completion.

Specified by:
execute in interface Scheduler
Parameters:
task - the Runnable to be executed.
Throws:
java.lang.InterruptedException - if the current thread is interrupted while waiting.

makeWaitable

protected java.lang.Runnable makeWaitable(java.lang.Runnable task,
                                          EDU.oswego.cs.dl.util.concurrent.Latch done)
Factory method for a Runnable to schedule.

Parameters:
task - the original task to schedule.
done - the latch indicating when the task has been executed.
Returns:
the Runnable to schedule.

schedule

public void schedule(java.lang.Runnable task)
Description copied from interface: Scheduler
This method schedules a Runnable for later execution.

Specified by:
schedule in interface Scheduler
Parameters:
task - the Runnable to be scheduled.

Trull

http://www.cs.luc.edu/trull/