Trull

edu.luc.cs.trull
Class DefaultScheduler

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

 class DefaultScheduler
extends FastScheduler

An implementation of the Scheduler interface based on Doug Lea's QueuedExecutor. It supports the await method.


Nested Class Summary
private  class DefaultScheduler.QueuedRunnable
          A wrapper around a runnable that decrements the queue length when the runnable has finished.
 
Nested classes/interfaces inherited from class edu.luc.cs.trull.FastScheduler
FastScheduler.WaitableRunnable
 
Field Summary
private static EDU.oswego.cs.dl.util.concurrent.Latch DUMMY
          A dummy latch to be used when scheduling Runnables without waiting for their execution.
private static org.apache.log4j.Logger logger
           
private  EDU.oswego.cs.dl.util.concurrent.WaitableInt queueLength
          The current length of the queue of Runnables.
 
Fields inherited from class edu.luc.cs.trull.FastScheduler
executor
 
Constructor Summary
DefaultScheduler()
           
 
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

DUMMY

private static EDU.oswego.cs.dl.util.concurrent.Latch DUMMY
A dummy latch to be used when scheduling Runnables without waiting for their execution.


logger

private static final org.apache.log4j.Logger logger

queueLength

private EDU.oswego.cs.dl.util.concurrent.WaitableInt queueLength
The current length of the queue of Runnables.

Constructor Detail

DefaultScheduler

DefaultScheduler()
Method Detail

await

public void await()
           throws java.lang.InterruptedException
Description copied from class: FastScheduler
This method is not supported in the interest of faster execution.

Specified by:
await in interface Scheduler
Overrides:
await in class FastScheduler
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
Overrides:
execute in class FastScheduler
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)
Description copied from class: FastScheduler
Factory method for a Runnable to schedule.

Overrides:
makeWaitable in class FastScheduler
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
Overrides:
schedule in class FastScheduler
Parameters:
task - the Runnable to be scheduled.

Trull

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