7143070: test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java freezes on exit
authorbagiras
Mon, 13 Feb 2012 17:49:23 +0400
changeset 11817 433d7f4ea51d
parent 11816 9bd62ce55848
child 11818 726dedadcc44
7143070: test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java freezes on exit Reviewed-by: anthony
jdk/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java
--- a/jdk/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java	Fri Feb 10 10:23:13 2012 -0800
+++ b/jdk/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java	Mon Feb 13 17:49:23 2012 +0400
@@ -54,9 +54,12 @@
             Util.clickOnComp(frame.button, robot);
         }
 
-        frame.panel.stop();
+        boolean ret = frame.panel.stop();
         frame.dispose();
 
+        if (!ret) {
+            throw new RuntimeException("Test failed!");
+        }
         System.out.println("Test passed.");
     }
 
@@ -140,17 +143,19 @@
         }
     }
 
-    public void stop() {
+    public boolean stop() {
         active = false;
         try {
-            synchronized (sync) {
-                sync.notify();
-            }
-            synchronized (thread) {
-                thread.wait();
+            sync();
+            thread.join(1000);
+            if (thread.isAlive()) {
+                thread.interrupt();
+                return false;
             }
         } catch (InterruptedException ex) {
+            return false;
         }
+        return true;
     }
 
     public void draw() {