-
Enhancement
-
Resolution: Incomplete
-
P4
-
None
-
8, 9, 10
A DESCRIPTION OF THE REQUEST :
We are facing performance issue because of blocking code in java.security.Permissions.
The code that is being accessed in java.security.Permissions.implies :
public boolean implies(Permission permission) {
// No sync; staleness -> skip optimization, which is OK
if (allPermission != null) {
return true; // AllPermission has already been added
} else {
synchronized (this) {
PermissionCollection pc = getPermissionCollection(permission,
false);
if (pc != null) {
return pc.implies(permission);
} else {
// none found
return false;
}
}
}
}
You will notice that the call here is within synchronized block which requires lock on instance monitor to proceed.
In my view, we should use a read write lock here such that multiple read operations can run in parallel without blocking each other as is the case now.
JUSTIFICATION :
Since Java is used in such large number of production deployments, it is mostly assumed that it is optimized for performance. As far as I know there is continuous endeavour to improve code quality and performance of JDK. I will appreciate if this issue is accepted and concerns specified here are addressed.
We are facing performance issue because of blocking code in java.security.Permissions.
The code that is being accessed in java.security.Permissions.implies :
public boolean implies(Permission permission) {
// No sync; staleness -> skip optimization, which is OK
if (allPermission != null) {
return true; // AllPermission has already been added
} else {
synchronized (this) {
PermissionCollection pc = getPermissionCollection(permission,
false);
if (pc != null) {
return pc.implies(permission);
} else {
// none found
return false;
}
}
}
}
You will notice that the call here is within synchronized block which requires lock on instance monitor to proceed.
In my view, we should use a read write lock here such that multiple read operations can run in parallel without blocking each other as is the case now.
JUSTIFICATION :
Since Java is used in such large number of production deployments, it is mostly assumed that it is optimized for performance. As far as I know there is continuous endeavour to improve code quality and performance of JDK. I will appreciate if this issue is accepted and concerns specified here are addressed.
- relates to
-
JDK-8056179 Store permissions in concurrent collections in PermissionCollection subclasses
-
- Closed
-