Clean up; remove need for synchronize

git-svn-id: svn://10.0.0.236/trunk@68148 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
norris%netscape.com
2000-05-03 21:55:09 +00:00
parent 4f03f6c1e0
commit a63b229d5a
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) {