Package org.jmock.lib.concurrent
Class Blitzer
java.lang.Object
org.jmock.lib.concurrent.Blitzer
A class that "blitzes" an object by calling it many times, from multiple
threads. Used for stress-testing synchronisation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
static final int
The default number of threads to run concurrently.private final ExecutorService
-
Constructor Summary
ConstructorsConstructorDescriptionBlitzer
(int actionCount) Blitzer
(int actionCount, int threadCount) Blitzer
(int actionCount, int threadCount, ThreadFactory threadFactory) Blitzer
(int actionCount, ExecutorService executorService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
shutdown()
private CountDownLatch
spawnThreads
(Runnable action) int
-
Field Details
-
DEFAULT_THREAD_COUNT
public static final int DEFAULT_THREAD_COUNTThe default number of threads to run concurrently.- See Also:
-
executorService
-
actionCount
private final int actionCount
-
-
Constructor Details
-
Blitzer
public Blitzer(int actionCount) -
Blitzer
public Blitzer(int actionCount, int threadCount) -
Blitzer
-
Blitzer
-
-
Method Details
-
totalActionCount
public int totalActionCount() -
blitz
- Throws:
InterruptedException
-
blitz
- Throws:
InterruptedException
TimeoutException
-
spawnThreads
-
shutdown
public void shutdown()
-