Clean up; remove need for synchronize

This commit is contained in:
norris%netscape.com 2000-05-03 21:55:09 +00:00
parent 8ff1c0fce6
commit 6e0e18c45e
2 changed files with 32 additions and 40 deletions

View File

@ -474,7 +474,8 @@ class JavaMembers {
Class staticType)
{
Class cl = dynamicType;
JavaMembers members = (JavaMembers) classTable.get(cl);
Hashtable ct = classTable; // use local reference to avoid synchronize
JavaMembers members = (JavaMembers) ct.get(cl);
if (members != null)
return members;
if (staticType != null && staticType != dynamicType &&
@ -483,26 +484,21 @@ class JavaMembers {
{
cl = staticType;
}
synchronized (classTable) {
members = (JavaMembers) classTable.get(cl);
if (members != null)
return members;
try {
members = new JavaMembers(scope, cl);
} catch (SecurityException e) {
// Reflection may fail for objects that are in a restricted
// access package (e.g. sun.*). If we get a security
// exception, try again with the static type. Otherwise,
// rethrow the exception.
if (cl != staticType)
members = new JavaMembers(scope, staticType);
else
throw e;
}
if (Context.isCachingEnabled)
classTable.put(cl, members);
return members;
try {
members = new JavaMembers(scope, cl);
} catch (SecurityException e) {
// Reflection may fail for objects that are in a restricted
// access package (e.g. sun.*). If we get a security
// exception, try again with the static type. Otherwise,
// rethrow the exception.
if (cl != staticType)
members = new JavaMembers(scope, staticType);
else
throw e;
}
if (Context.isCachingEnabled)
ct.put(cl, members);
return members;
}
RuntimeException reportMemberNotFound(String memberName) {

View File

@ -474,7 +474,8 @@ class JavaMembers {
Class staticType)
{
Class cl = dynamicType;
JavaMembers members = (JavaMembers) classTable.get(cl);
Hashtable ct = classTable; // use local reference to avoid synchronize
JavaMembers members = (JavaMembers) ct.get(cl);
if (members != null)
return members;
if (staticType != null && staticType != dynamicType &&
@ -483,26 +484,21 @@ class JavaMembers {
{
cl = staticType;
}
synchronized (classTable) {
members = (JavaMembers) classTable.get(cl);
if (members != null)
return members;
try {
members = new JavaMembers(scope, cl);
} catch (SecurityException e) {
// Reflection may fail for objects that are in a restricted
// access package (e.g. sun.*). If we get a security
// exception, try again with the static type. Otherwise,
// rethrow the exception.
if (cl != staticType)
members = new JavaMembers(scope, staticType);
else
throw e;
}
if (Context.isCachingEnabled)
classTable.put(cl, members);
return members;
try {
members = new JavaMembers(scope, cl);
} catch (SecurityException e) {
// Reflection may fail for objects that are in a restricted
// access package (e.g. sun.*). If we get a security
// exception, try again with the static type. Otherwise,
// rethrow the exception.
if (cl != staticType)
members = new JavaMembers(scope, staticType);
else
throw e;
}
if (Context.isCachingEnabled)
ct.put(cl, members);
return members;
}
RuntimeException reportMemberNotFound(String memberName) {