зеркало из https://github.com/mozilla/gecko-dev.git
Patch from jeffh@aiinet.com:
I have found a couple problems with running Rhino 1.5R2 in a heavily multi-threaded environment. The attached patches fix the problems. - org.mozilla.javascript.optimizer.InvokerImpl - This class was accessing the shared classNumber outside of the synchronized block. - org.mozilla.javascript.optimizer.OptClassNameHelper - The reset method was not synchronized. It needs to be because the class using the classNames map is synchronized and does not handle nulling of the variable while it's looping on the map. Jeff
This commit is contained in:
Родитель
4507a1cf73
Коммит
a19d5beda6
|
@ -56,11 +56,12 @@ public class InvokerImpl extends Invoker {
|
|||
Invoker result = (Invoker)invokersCache.get(method);
|
||||
if (result != null) { return result; }
|
||||
|
||||
int classNum = 0;
|
||||
synchronized (this) {
|
||||
++classNumber;
|
||||
classNum = ++classNumber;
|
||||
}
|
||||
|
||||
String className = "inv" + classNumber;
|
||||
String className = "inv" + classNum;
|
||||
|
||||
ClassFileWriter cfw = new ClassFileWriter(className,
|
||||
"org.mozilla.javascript.Invoker", "");
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OptClassNameHelper implements ClassNameHelper {
|
|||
return generatingDirectory;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
public synchronized void reset() {
|
||||
classNames = null;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче