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

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