|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.luc.cs.trull.FastScheduler
edu.luc.cs.trull.DefaultScheduler
class DefaultScheduler
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 |
|---|
private static EDU.oswego.cs.dl.util.concurrent.Latch DUMMY
private static final org.apache.log4j.Logger logger
private EDU.oswego.cs.dl.util.concurrent.WaitableInt queueLength
| Constructor Detail |
|---|
DefaultScheduler()
| Method Detail |
|---|
public void await()
throws java.lang.InterruptedException
FastScheduler
await in interface Schedulerawait in class FastSchedulerjava.lang.InterruptedException - if the current thread is interrupted while waiting.
public void execute(java.lang.Runnable task)
throws java.lang.InterruptedException
Scheduler
execute in interface Schedulerexecute in class FastSchedulertask - the Runnable to be executed.
java.lang.InterruptedException - if the current thread is interrupted while waiting.
protected java.lang.Runnable makeWaitable(java.lang.Runnable task,
EDU.oswego.cs.dl.util.concurrent.Latch done)
FastScheduler
makeWaitable in class FastSchedulertask - the original task to schedule.done - the latch indicating when the task has been executed.
public void schedule(java.lang.Runnable task)
Scheduler
schedule in interface Schedulerschedule in class FastSchedulertask - the Runnable to be scheduled.
|
Trull | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||