Uploaded image for project: 'Commons JXPath'
  1. Commons JXPath
  2. JXPATH-179

Too much synchronization in JXPathIntrospector

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.4
    • None

    Description

      The class JXPathIntrospector has been refactored lately to use Collections.synchronizedMap for the static [byClass] and [byInterface] maps, however access to them in code is still synchronized, while I believe it should be not since the synchronized-map methods are already locked on the instance and only one operation is involved.

      I propose to remove the synchronized keyword from the following blocks:

      https://github.com/apache/commons-jxpath/blob/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java#L71

      https://github.com/apache/commons-jxpath/blob/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java#L89

      https://github.com/apache/commons-jxpath/blob/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java#L94

      https://github.com/apache/commons-jxpath/blob/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java#L125

      I also dont' see any reason why findInformant() should be synchronized and propose to make it not synchronized. Current code does not use any static field so is safe to change and does not prevent creation of duplicate JXPathBeanInfo instances that however I believe is not relevant.

      https://github.com/apache/commons-jxpath/blob/trunk/src/java/org/apache/commons/jxpath/JXPathIntrospector.java#L177

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vivodamichele@hotmail.com Michele Vivoda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Time Spent - 10m Remaining Estimate - 50m
                  50m
                  Logged:
                  Time Spent - 10m Remaining Estimate - 50m
                  10m