You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/11/25 11:29:23 UTC
svn commit: r1038994 -
/directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java
Author: seelmann
Date: Thu Nov 25 10:29:23 2010
New Revision: 1038994
URL: http://svn.apache.org/viewvc?rev=1038994&view=rev
Log:
Add support for non-threadsafe test classes
Modified:
directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java
Modified: directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java
URL: http://svn.apache.org/viewvc/directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java?rev=1038994&r1=1038993&r2=1038994&view=diff
==============================================================================
--- directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java (original)
+++ directory/buildtools/trunk/junit-addons/src/main/java/org/apache/directory/junit/tools/MultiThreadedMultiInvoker.java Thu Nov 25 10:29:23 2010
@@ -44,6 +44,8 @@ import org.junit.runners.model.Statement
*/
public class MultiThreadedMultiInvoker implements MethodRule
{
+ public static final boolean THREADSAFE = true;
+ public static final boolean NOT_THREADSAFE = false;
private static AtomicInteger threadCounter = new AtomicInteger();
private int numThreads;
private int numInvocationsPerThread;
@@ -55,10 +57,12 @@ public class MultiThreadedMultiInvoker i
*
* The number of threads and invocations per thread are derived from
* system properties 'threads' and 'invocations'.
+ *
+ * @param threadSafe whether the tested class is thread safe
*/
- public MultiThreadedMultiInvoker()
+ public MultiThreadedMultiInvoker( boolean threadSafe )
{
- this.numThreads = getSystemIntProperty( "mtmi.threads", 1 );
+ this.numThreads = threadSafe ? getSystemIntProperty( "mtmi.threads", 1 ) : 1;
this.numInvocationsPerThread = getSystemIntProperty( "mtmi.invocations", 1 );
this.trace = getSystemBoolProperty( "mtmi.trace", false );
}