提交 c2488b17 编写于 作者: D dcherepanov

7011442: AppletClassLoader.java needs to avoid spurious wakeup

Reviewed-by: anthony
上级 93b2d011
...@@ -663,13 +663,15 @@ public class AppletClassLoader extends URLClassLoader { ...@@ -663,13 +663,15 @@ public class AppletClassLoader extends URLClassLoader {
// set the context class loader to the AppletClassLoader. // set the context class loader to the AppletClassLoader.
creatorThread.setContextClassLoader(AppletClassLoader.this); creatorThread.setContextClassLoader(AppletClassLoader.this);
synchronized(creatorThread.syncObject) { creatorThread.start();
creatorThread.start(); try {
try { synchronized(creatorThread.syncObject) {
creatorThread.syncObject.wait(); while (!creatorThread.created) {
} catch (InterruptedException e) { } creatorThread.syncObject.wait();
appContext = creatorThread.appContext; }
} }
} catch (InterruptedException e) { }
appContext = creatorThread.appContext;
return null; return null;
} }
}); });
...@@ -854,14 +856,16 @@ public void grab() { ...@@ -854,14 +856,16 @@ public void grab() {
class AppContextCreator extends Thread { class AppContextCreator extends Thread {
Object syncObject = new Object(); Object syncObject = new Object();
AppContext appContext = null; AppContext appContext = null;
volatile boolean created = false;
AppContextCreator(ThreadGroup group) { AppContextCreator(ThreadGroup group) {
super(group, "AppContextCreator"); super(group, "AppContextCreator");
} }
public void run() { public void run() {
synchronized(syncObject) { appContext = SunToolkit.createNewAppContext();
appContext = SunToolkit.createNewAppContext(); created = true;
synchronized(syncObject) {
syncObject.notifyAll(); syncObject.notifyAll();
} }
} // run() } // run()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册