8273704: DrawStringWithInfiniteXform.java failed : drawString with InfiniteXform transform takes long time
Reviewed-by: serb, psadhukhan
This commit is contained in:
parent
2eafa036c0
commit
acceffcbf7
@ -35,11 +35,12 @@ import java.util.Timer;
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class DrawStringWithInfiniteXform {
|
public class DrawStringWithInfiniteXform {
|
||||||
Timer timer;
|
|
||||||
boolean done;
|
volatile Timer timer;
|
||||||
|
volatile boolean done;
|
||||||
|
|
||||||
class ScheduleTask extends TimerTask {
|
class ScheduleTask extends TimerTask {
|
||||||
public void run() {
|
public void run() {
|
||||||
timer.cancel();
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
throw new
|
throw new
|
||||||
RuntimeException("drawString with InfiniteXform transform takes long time");
|
RuntimeException("drawString with InfiniteXform transform takes long time");
|
||||||
@ -48,7 +49,7 @@ public class DrawStringWithInfiniteXform {
|
|||||||
}
|
}
|
||||||
public DrawStringWithInfiniteXform() {
|
public DrawStringWithInfiniteXform() {
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.schedule(new ScheduleTask(), 10000);
|
timer.schedule(new ScheduleTask(), 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String [] args) {
|
public static void main(String [] args) {
|
||||||
@ -73,6 +74,7 @@ public class DrawStringWithInfiniteXform {
|
|||||||
g2d.drawString("abc", 20, 20);
|
g2d.drawString("abc", 20, 20);
|
||||||
}
|
}
|
||||||
done = true;
|
done = true;
|
||||||
|
timer.cancel();
|
||||||
System.out.println("Test passed");
|
System.out.println("Test passed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user