Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2441

TestNullSafeConcurrentHashMap fails when running on Oracle Java 8

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 2.4.0
    • Component/s: lib
    • Labels:
      None
    • Environment:
      >java -version
      java version "1.8.0-ea"
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b109)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b51, mixed mode)

      Description

      While testing with Java 8 I found that org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap doesn't work on Oracle Java 8 as java.util.ConcurrentHashMap was completely rewritten and it doesn't like playing with our extension.

      I'm not sure what the correct solution for this JIRA will be, but I wanted to get it documented. I did a small amount of searching and it appears that NullSafeConcurrentHashMap isn't used very much in our code base so it might be easiest to remove those references and deprecate the data structure. That being said, we'll still need to fix this data structure as it is possible that a user of OpenJPA pulled this structure into app code.

      1. 2441.patch
        22 kB
        Dalia Abo Sheasha

        Issue Links

          Activity

          Hide
          dalia Dalia Abo Sheasha added a comment -

          I have attached a patch where NullSafeConcurrentHashMap is deprecated as well as SizedConcurrentHashMap since it extends NullSafeConcurrentHashMap. Naturally, the tests corresponding to both classes were removed. Any usage of the SizedConcurrentHashMap data structure was replaced by a ConcurrentReferenceHashMap which supports setting a maximum size for the map. Usage of NullSafeConcurrentHashMap was replaced by ConcurrentHashMap. Since this change required replacing some operations, I added some tests to make sure the logic for the method using NullSafeConcurrentHashMap is still working as intended.

          Show
          dalia Dalia Abo Sheasha added a comment - I have attached a patch where NullSafeConcurrentHashMap is deprecated as well as SizedConcurrentHashMap since it extends NullSafeConcurrentHashMap. Naturally, the tests corresponding to both classes were removed. Any usage of the SizedConcurrentHashMap data structure was replaced by a ConcurrentReferenceHashMap which supports setting a maximum size for the map. Usage of NullSafeConcurrentHashMap was replaced by ConcurrentHashMap. Since this change required replacing some operations, I added some tests to make sure the logic for the method using NullSafeConcurrentHashMap is still working as intended.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1570261 from Rick Curtis in branch 'openjpa/trunk'
          [ https://svn.apache.org/r1570261 ]

          OPENJPA-2441: Remove usage of NullSafeConcurrentHashMap. Patch contributed by Dalia Abo Sheasha.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1570261 from Rick Curtis in branch 'openjpa/trunk' [ https://svn.apache.org/r1570261 ] OPENJPA-2441 : Remove usage of NullSafeConcurrentHashMap. Patch contributed by Dalia Abo Sheasha.
          Hide
          curtisr7 Rick Curtis added a comment -

          Committed revision 1570261 to trunk.

          Thanks for the patch Dalia!

          Show
          curtisr7 Rick Curtis added a comment - Committed revision 1570261 to trunk. Thanks for the patch Dalia!
          Hide
          puntogil gil cattaneo added a comment -

          hi,
          used:
          OpenJDK version "1.8.0_11"
          OpenJDK Runtime Environment (build 1.8.0_11-b12)
          OpenJDK Zero VM (build 25.11-b02, interpreted mode)

          applied the patch for java 8 problems, but now i have still this problem:

          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project openjpa-persistence: Compilation failure: Compilation failure:
          [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java:[164,64] cannot find symbol
          [ERROR] symbol: method booleanValue()
          [ERROR] location: class java.lang.Object
          [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java:[167,43] cannot find symbol
          [ERROR] symbol: method booleanValue()
          [ERROR] location: class java.lang.Object
          [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java:[217,13] cannot find symbol
          [ERROR] symbol: method booleanValue()
          [ERROR] location: class java.lang.Object
          [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java:[239,44] cannot find symbol
          [ERROR] symbol: method booleanValue()
          [ERROR] location: class java.lang.Object
          [ERROR] -> [Help 1]

          thanks in advance

          Show
          puntogil gil cattaneo added a comment - hi, used: OpenJDK version "1.8.0_11" OpenJDK Runtime Environment (build 1.8.0_11-b12) OpenJDK Zero VM (build 25.11-b02, interpreted mode) applied the patch for java 8 problems, but now i have still this problem: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project openjpa-persistence: Compilation failure: Compilation failure: [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java: [164,64] cannot find symbol [ERROR] symbol: method booleanValue() [ERROR] location: class java.lang.Object [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java: [167,43] cannot find symbol [ERROR] symbol: method booleanValue() [ERROR] location: class java.lang.Object [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java: [217,13] cannot find symbol [ERROR] symbol: method booleanValue() [ERROR] location: class java.lang.Object [ERROR] /builddir/build/BUILD/apache-openjpa-2.2.2-source/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceXMLMetaDataParser.java: [239,44] cannot find symbol [ERROR] symbol: method booleanValue() [ERROR] location: class java.lang.Object [ERROR] -> [Help 1] thanks in advance
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1641472 from Jody Grassel in branch 'openjpa/branches/2.2.x'
          [ https://svn.apache.org/r1641472 ]

          OPENJPA-2441: Remove usage of NullSafeConcurrentHashMap. [JDK8]

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1641472 from Jody Grassel in branch 'openjpa/branches/2.2.x' [ https://svn.apache.org/r1641472 ] OPENJPA-2441 : Remove usage of NullSafeConcurrentHashMap. [JDK8]

            People

            • Assignee:
              curtisr7 Rick Curtis
              Reporter:
              curtisr7 Rick Curtis
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development