6801769: 6588003 should be backed out from jdk7

Reviewed-by: alexp
This commit is contained in:
Peter Zhelezniakov 2009-02-05 19:16:13 +03:00
parent 8f96eb9cea
commit a21476939e

View File

@ -25,7 +25,6 @@
package javax.swing.text; package javax.swing.text;
import java.util.Vector; import java.util.Vector;
import sun.awt.AppContext;
/** /**
* A queue of text layout tasks. * A queue of text layout tasks.
@ -36,10 +35,10 @@ import sun.awt.AppContext;
*/ */
public class LayoutQueue { public class LayoutQueue {
private static final Object DEFAULT_QUEUE = new Object(); Vector<Runnable> tasks;
Thread worker;
private Vector<Runnable> tasks; static LayoutQueue defaultQueue;
private Thread worker;
/** /**
* Construct a layout queue. * Construct a layout queue.
@ -52,31 +51,19 @@ public class LayoutQueue {
* Fetch the default layout queue. * Fetch the default layout queue.
*/ */
public static LayoutQueue getDefaultQueue() { public static LayoutQueue getDefaultQueue() {
AppContext ac = AppContext.getAppContext(); if (defaultQueue == null) {
synchronized (DEFAULT_QUEUE) { defaultQueue = new LayoutQueue();
LayoutQueue defaultQueue = (LayoutQueue) ac.get(DEFAULT_QUEUE);
if (defaultQueue == null) {
defaultQueue = new LayoutQueue();
ac.put(DEFAULT_QUEUE, defaultQueue);
}
return defaultQueue;
} }
return defaultQueue;
} }
/** /**
* Set the default layout queue. * Set the default layout queue.
* *
* @param defaultQueue the new queue. * @param q the new queue.
*/ */
public static void setDefaultQueue(LayoutQueue defaultQueue) { public static void setDefaultQueue(LayoutQueue q) {
synchronized (DEFAULT_QUEUE) { defaultQueue = q;
AppContext ac = AppContext.getAppContext();
if (defaultQueue == null) {
ac.remove(DEFAULT_QUEUE);
} else {
ac.put(DEFAULT_QUEUE, defaultQueue);
}
}
} }
/** /**