Blame SOURCES/0004-Make-thread-stress-test-more-robust.patch

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