|
|
78a2f7 |
From c884a17bfaa3f3ff4a802b3de9e06d48c494eb68 Mon Sep 17 00:00:00 2001
|
|
|
78a2f7 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
78a2f7 |
Date: Tue, 5 Nov 2013 14:00:03 +0100
|
|
|
78a2f7 |
Subject: [PATCH 04/39] Make thread stress test more robust
|
|
|
78a2f7 |
|
|
|
78a2f7 |
Related to #21
|
|
|
78a2f7 |
Related to rhbz#1051483
|
|
|
78a2f7 |
---
|
|
|
78a2f7 |
test/ThreadStressTest.java | 22 +++++++++++++++-------
|
|
|
78a2f7 |
1 file changed, 15 insertions(+), 7 deletions(-)
|
|
|
78a2f7 |
|
|
|
78a2f7 |
diff --git a/test/ThreadStressTest.java b/test/ThreadStressTest.java
|
|
|
78a2f7 |
index 3ebf9e0..981ba91 100644
|
|
|
78a2f7 |
--- a/test/ThreadStressTest.java
|
|
|
78a2f7 |
+++ b/test/ThreadStressTest.java
|
|
|
78a2f7 |
@@ -46,22 +46,29 @@ public class ThreadStressTest {
|
|
|
78a2f7 |
|
|
|
78a2f7 |
List<Thread> tojoin = new LinkedList<Thread>();
|
|
|
78a2f7 |
|
|
|
78a2f7 |
- for (int i = 100; i != 0; --i) {
|
|
|
78a2f7 |
- for (int j = 300; j != 0; --j) {
|
|
|
78a2f7 |
- Thread t = new ThreadCaughtException();
|
|
|
78a2f7 |
- tojoin.add(t);
|
|
|
78a2f7 |
- System.out.println("Starting Thread: " + Integer.toString((i * j) + j));
|
|
|
78a2f7 |
- t.start();
|
|
|
78a2f7 |
+ for (int i = 60; i != 0; --i) {
|
|
|
78a2f7 |
+ for (int j = 600; j != 0; --j) {
|
|
|
78a2f7 |
+ try {
|
|
|
78a2f7 |
+ Thread t = new ThreadCaughtException();
|
|
|
78a2f7 |
+ tojoin.add(t);
|
|
|
78a2f7 |
+ System.out.println("Starting Thread: " + Integer.toString((i * j) + j));
|
|
|
78a2f7 |
+ t.start();
|
|
|
78a2f7 |
+ }
|
|
|
78a2f7 |
+ catch(Throwable t) {
|
|
|
78a2f7 |
+ System.out.println("Thread start: " + t.toString());
|
|
|
78a2f7 |
+ System.exit(1);
|
|
|
78a2f7 |
+ }
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
|
|
|
78a2f7 |
try {
|
|
|
78a2f7 |
- Thread.currentThread().sleep(1000);
|
|
|
78a2f7 |
+ Thread.currentThread().sleep(500);
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
catch (InterruptedException ex) {
|
|
|
78a2f7 |
System.out.println("Interrupted");
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
|
|
|
78a2f7 |
+ System.out.println("All Threads Started");
|
|
|
78a2f7 |
for (Thread t : tojoin) {
|
|
|
78a2f7 |
try {
|
|
|
78a2f7 |
t.join();
|
|
|
78a2f7 |
@@ -71,6 +78,7 @@ public class ThreadStressTest {
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
|
|
|
78a2f7 |
+ System.out.println("All Threads Finished");
|
|
|
78a2f7 |
System.exit(0);
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
}
|
|
|
78a2f7 |
--
|
|
|
78a2f7 |
1.8.3.1
|
|
|
78a2f7 |
|