Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191850

Performance issue with synchronized blocks in java.security.Permissions

    XMLWordPrintable

    Details

      Description

      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.


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: