提交 0601dadc 编写于 作者: P peterz

6837293: Reapply fix for 6588003 to JDK7

Reviewed-by: alexp
上级 d21eba9c
......@@ -25,6 +25,7 @@
package javax.swing.text;
import java.util.Vector;
import sun.awt.AppContext;
/**
* A queue of text layout tasks.
......@@ -35,10 +36,10 @@ import java.util.Vector;
*/
public class LayoutQueue {
Vector<Runnable> tasks;
Thread worker;
private static final Object DEFAULT_QUEUE = new Object();
static LayoutQueue defaultQueue;
private Vector<Runnable> tasks;
private Thread worker;
/**
* Construct a layout queue.
......@@ -51,10 +52,15 @@ public class LayoutQueue {
* Fetch the default layout queue.
*/
public static LayoutQueue getDefaultQueue() {
if (defaultQueue == null) {
defaultQueue = new LayoutQueue();
AppContext ac = AppContext.getAppContext();
synchronized (DEFAULT_QUEUE) {
LayoutQueue defaultQueue = (LayoutQueue) ac.get(DEFAULT_QUEUE);
if (defaultQueue == null) {
defaultQueue = new LayoutQueue();
ac.put(DEFAULT_QUEUE, defaultQueue);
}
return defaultQueue;
}
return defaultQueue;
}
/**
......@@ -63,7 +69,9 @@ public class LayoutQueue {
* @param q the new queue.
*/
public static void setDefaultQueue(LayoutQueue q) {
defaultQueue = q;
synchronized (DEFAULT_QUEUE) {
AppContext.getAppContext().put(DEFAULT_QUEUE, q);
}
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册