nl.toolforge.karma.core.vc.threads
Class ParallelRunner

java.lang.Object
  extended bynl.toolforge.karma.core.vc.threads.ParallelRunner

public class ParallelRunner
extends java.lang.Object

The ParallelRunner handles parallel RunnerThreads. This concept should be used when parallel read actions on version control repositories are possible to speed up the process of performing commands for each module in a manifest.

Version:
$Id: ParallelRunner.java,v 1.10 2004/11/16 22:31:58 asmedes Exp $
Author:
D.A. Smedes

Field Summary
(package private)  org.apache.commons.logging.Log logger
           
 
Constructor Summary
ParallelRunner(Manifest manifest, java.lang.Class threadClass)
          Initializes this ParallelRunner with the correct Manifest.
 
Method Summary
 void execute()
          Starts all threads, and processes the results.
 void execute(int blockSize, long delayInMilliseconds)
          Starts all threads, and processes the results.
 void execute(long delayInMilliseconds)
          Starts all threads, and processes the results.
 java.util.Map retrieveResults()
          Returns a map of ModuleStatus objects, each accessible by the the corresponding Module instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

org.apache.commons.logging.Log logger
Constructor Detail

ParallelRunner

public ParallelRunner(Manifest manifest,
                      java.lang.Class threadClass)
Initializes this ParallelRunner with the correct Manifest. Call execute() or execute(int, long) to start all threads.

Parameters:
manifest - The manifest.
threadClass - A Class instance, extending Thread.
Method Detail

execute

public void execute(long delayInMilliseconds)
Starts all threads, and processes the results. Results can be retrieved by calling retrieveResults().

Parameters:
delayInMilliseconds - The delay in milliseconds between the start of each thread.

execute

public void execute()
Starts all threads, and processes the results. Results can be retrieved by calling retrieveResults(). Note that no restriction is imposed on the amount of threads, and they are started as soon as possible.

See Also:
execute(long), execute(int, long)

execute

public void execute(int blockSize,
                    long delayInMilliseconds)
Starts all threads, and processes the results. Results can be retrieved by calling retrieveResults().

Parameters:
blockSize - Determines the amount of threads that will be started in one block, with a delay of delayInMilliseconds. If all threads should be started as one block, a negative blockSize should be provided. When a positive blocksize is provided, a default delay of 1000 milliseconds is used between blocks. Note this feature is currently ignored.
delayInMilliseconds - The delay in milliseconds between threads in a block (or all threads if blockSize is negative.

retrieveResults

public java.util.Map retrieveResults()
Returns a map of ModuleStatus objects, each accessible by the the corresponding Module instance.

Returns:
A map, containing ModuleStatus objects.


Copyright © 2002-2004 Toolforge. All Rights Reserved.