|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
live.threads.ThreadedUserAction
live.threads.Runner
This class is a container that holds ThreadedUserActions that should be run
later. It is itself a ThreadedUserAction, so has run(), start(), etc. methods.
In this case, when they are called, the runner should kick off all the tasks
that it has stored. There are (TODO) two concrete subclasses of this,
SequentialRunner and ParallelRunner, based upon whether the tasks can be run
in parallel or not. (Note that the distinction is NOT upon whether they
actually do run in parallel, just whether they can. See the docs for
each of these for more detail, especially ParallelRunner.)
To use this, make an object of one of the concrete runners, call
schedule(ThreadedUserAction)
for each task you want to run,
then call Thread.start()
or any of the other
functions that will start the thread.
To retrieve the results, call rawResult()
. This returns a linked
list of the ThreadedUserActions that were passed to
schedule(...) before. You can iterate through this list and call
ThreadedUserAction.rawResult()
on each of them. Also,
ThreadedUserAction.result()
should return an error message if an exception is thrown
by one of the threads (subject to its implementation by a subclass).
Nested Class Summary |
Nested classes inherited from class live.threads.ThreadedUserAction |
|
Field Summary | |
private String |
description
This stores occurances of exceptions and the task that caused them so they can be reported |
protected ThreadInitInfo |
initInfo
|
private ThreadInitInfo |
modifiedInfo
This holds a modified version of the ThreadInitInfo object that was passed in. |
protected LinkedList |
taskList
|
Fields inherited from class live.threads.ThreadedUserAction |
CANCELED, COMPLETE, done, ERROR, IN_PROGRESS, INDETERMINATE, PENDING, tasks |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Runner()
|
Method Summary | |
String |
description()
This returns the description set in init |
void |
init(ThreadInitInfo info,
String description)
Does the trickery necessary in order to create a new ThreadInitInfo object local to the thread. |
void |
init(ThreadInitInfo info,
String description,
boolean removeLists)
Does the trickery necessary in order to create a new ThreadInitInfo object local to the thread. |
Object |
rawResult()
Returns the tasks that are to be/are being/have been done |
void |
schedule(ThreadedUserAction action)
This adds action to the list of subactions that will be run |
void |
setCanceled()
Sets the thread as canceled |
Methods inherited from class live.threads.ThreadedUserAction |
getCache, getException, getID, getStatus, getTimeFinished, getTimeStarted, init, init, isFinished, result, run, runImpl, setComplete, setError, setError, setIndeterminate, setIndeterminate, setInProgress, startJoinForever, startJoinTimeout, startNoJoin, toString |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private String description
private ThreadInitInfo modifiedInfo
init(ThreadInitInfo, String)
takes the ThreadInitInfo
passed in, and makes a new one local to the runner with the same
ConnectionInfo and a different ActiveThreadsInfo. (TODO: make teh local Active object)
protected LinkedList taskList
protected ThreadInitInfo initInfo
Constructor Detail |
public Runner()
Method Detail |
public final void init(ThreadInitInfo info, String description)
info
- description
- public final void init(ThreadInitInfo info, String description, boolean removeLists)
info
- description
- removeLists
- public void schedule(ThreadedUserAction action)
action
- The action to schedulepublic String description()
description
in class ThreadedUserAction
ThreadedUserAction.description()
public Object rawResult()
rawResult
in class ThreadedUserAction
public void setCanceled()
setCanceled
in class ThreadedUserAction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |