|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.foundation.run.Runner
public class Runner
Runs when it can, but never on empty. A thread services a queue of Runnables.
| Constructor Summary | |
|---|---|
Runner()
Makes a Runner, and starts the thread that services its queue. |
|
Runner(String name)
Makes a Runner, and starts the thread that services its queue. |
|
| Method Summary | |
|---|---|
static Runner |
currentRunner()
If called from within a thread servicing a Runner, returns that Runner. |
void |
enqueue(Runnable todo)
Queues something for this Runnable's thread to do. |
boolean |
isCurrentThreadInRunner()
Tests whether the current thread is holding the run lock |
boolean |
isShuttingDown()
Tests if an orderlyShutdown been requested. |
Object |
now(Callable<Object> todo)
Schedules a thunk to execute "inside" this runner (in the RunnerThread as a separate turn while holding the runLock), while also effectively executing as a synchronous call within the requestors's thread. |
void |
orderlyShutdown()
Will enqueue a request to shut down this runner's thread. |
void |
run()
Called only by Thread.start(). |
static void |
throwIfMandatory(Throwable t)
Utility routine to either swallow or throw exceptions, depending on whether or not they are the kind of exceptions that need to escape from the run loop. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Runner()
public Runner(String name)
name - is the name to give to the thread created.| Method Detail |
|---|
public static Runner currentRunner()
public static void throwIfMandatory(Throwable t)
public void enqueue(Runnable todo)
public boolean isCurrentThreadInRunner()
public Object now(Callable<Object> todo)
public void orderlyShutdown()
public boolean isShuttingDown()
public void run()
Thread.start(). Pulls Runnables off of the queue
until there aren't any more, then waits until there's more to do.
run in interface Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||