org.apache.avalon.excalibur.testcase
Class LatchedThreadGroup

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.testcase.LatchedThreadGroup
All Implemented Interfaces:
LogEnabled

public class LatchedThreadGroup
extends AbstractLogEnabled

This class is useful for writing MultiThreaded test cases where you need to perform multithreaded load testing on a component.

An instance of will create a block of threads of the specified size. Each thread will be assigned to run a specified Runnable instance. The threads will then all wait at a latch until the go method is called. The go method will not return until all of the Runnables have completed.

Version:
$Id: LatchedThreadGroup.java,v 1.1 2003/03/07 19:34:31 bloritsch Exp $
Author:
Leif Mortenson

Constructor Summary
LatchedThreadGroup(Runnable[] runnables)
          Creates a LatchedThreadGroup with a thread for each Runnable in the runnables array.
LatchedThreadGroup(Runnable runnable, int threadCount)
          Creates a LatchedThreadGroup with threadCount threads each running runnable.
 
Method Summary
 long go()
          Causes all of the Runnables to start at the same instance.
protected  void resetMemory()
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LatchedThreadGroup

public LatchedThreadGroup(Runnable[] runnables)
Creates a LatchedThreadGroup with a thread for each Runnable in the runnables array.


LatchedThreadGroup

public LatchedThreadGroup(Runnable runnable,
                          int threadCount)
Creates a LatchedThreadGroup with threadCount threads each running runnable.

Method Detail

resetMemory

protected void resetMemory()

go

public long go()
        throws Exception
Causes all of the Runnables to start at the same instance. This method will return once all of the Runnables have completed.

Returns:
time, in milliseconds, that it took for all of the Runnables to complete.
Exception


Copyright © 2000-2002 Apache Jakarta Project. All Rights Reserved.