live.threads
Class ParallelRunner

java.lang.Object
  extended byjava.lang.Thread
      extended bylive.threads.ThreadedUserAction
          extended bylive.threads.Runner
              extended bylive.threads.ParallelRunner
All Implemented Interfaces:
Runnable

public class ParallelRunner
extends Runner

This is an early version of the parallel runner. Currently it doesn't support the parallelism parameter, but the constructor is there so that client code needn't be changed later after support is added.

Author:
Evan Driscoll

Nested Class Summary
 
Nested classes inherited from class live.threads.ThreadedUserAction
 
Field Summary
private  ActiveThreadsInfo active
           
private static int DEFAULT_PARALLELISM
           
private  ThreadInitInfo info
           
private  int thisThreadsParallelism
           
private static int THREAD_CHECK_WAIT_MS
           
 
Fields inherited from class live.threads.Runner
initInfo, 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
ParallelRunner(ThreadInitInfo initInfo, String description)
          Constructs a parallel runner with the default parallelism
ParallelRunner(ThreadInitInfo initInfo, String description, int parallelism)
          Constructs a parallelRunner with a specified parallelism (number of threads to run at once)
 
Method Summary
protected  void runImpl()
          Starts the threads, up to thisThreadsParallelism of them at a time
 
Methods inherited from class live.threads.Runner
description, init, init, rawResult, schedule, setCanceled
 
Methods inherited from class live.threads.ThreadedUserAction
getCache, getException, getID, getStatus, getTimeFinished, getTimeStarted, init, init, isFinished, result, run, 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

DEFAULT_PARALLELISM

private static final int DEFAULT_PARALLELISM
See Also:
Constant Field Values

THREAD_CHECK_WAIT_MS

private static final int THREAD_CHECK_WAIT_MS
See Also:
Constant Field Values

thisThreadsParallelism

private int thisThreadsParallelism

active

private final ActiveThreadsInfo active

info

private final ThreadInitInfo info
Constructor Detail

ParallelRunner

public ParallelRunner(ThreadInitInfo initInfo,
                      String description,
                      int parallelism)
Constructs a parallelRunner with a specified parallelism (number of threads to run at once)

Parameters:
initInfo - Thread initialization information
description - Description of the thread
parallelism - How many threads to run at once

ParallelRunner

public ParallelRunner(ThreadInitInfo initInfo,
                      String description)
Constructs a parallel runner with the default parallelism

Parameters:
initInfo - Initialization information for the thread
description - Description of the thread
Method Detail

runImpl

protected void runImpl()
                throws Exception
Starts the threads, up to thisThreadsParallelism of them at a time

Specified by:
runImpl in class ThreadedUserAction
Throws:
Exception
See Also:
ThreadedUserAction.run()


Copyright © 2005