Need to synchonize a hashmap in the ofbiz memoryHelper that we use for unit tests

XMLWordPrintable

    • 3.06

      The ofbiz org.ofbiz.core.entity.MemoryHelper does not react well to multiple threads, we just need to synch the hashmap. The exception we got looked like this:

          [junit] "Thread-4" prio=1 tid=0x9cda89c8 nid=0x31e runnable [9c954000..9c95486c]
          [junit]     at java.util.HashMap.put(HashMap.java:382)
          [junit]     at org.ofbiz.core.entity.MemoryHelper.addToCache(MemoryHelper.java:71)
          [junit]     at org.ofbiz.core.entity.MemoryHelper.create(MemoryHelper.java:255)
          [junit]     at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:470)
          [junit]     at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:450)
          [junit]     at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:77)
          [junit]     at com.atlassian.jira.action.admin.ImportParser$1.run(ImportParser.java:191)
          [junit]     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:751)
          [junit]     at java.lang.Thread.run(Thread.java:534)
          [junit]
          [junit] "JiraQuartzScheduler_QuartzSchedulerThread" prio=1 tid=0x9cd350b8 nid=0x31e in Object.wait() [9cbd9000..9cbd986c]
          [junit]     at java.lang.Object.wait(Native Method)
          [junit]     at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:217)
          [junit]     - locked <0xa0389f08> (a java.lang.Object)
          [junit]
          [junit] "JiraQuartzScheduler_Worker-0" prio=1 tid=0x9cd32e38 nid=0x31e in Object.wait() [9cc5a000..9cc5a86c]
          [junit]     at java.lang.Object.wait(Native Method)
          [junit]     at org.quartz.simpl.SimpleThreadPool.getNextRunnable(SimpleThreadPool.java:423)
          [junit]     - locked <0xa0381da0> (a java.lang.Object)
          [junit]     at org.quartz.simpl.SimpleThreadPool.access$000(SimpleThreadPool.java:53)
          [junit]     at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:514)
          [junit]
          [junit] "Signal Dispatcher" daemon prio=1 tid=0x0809a0c8 nid=0x31e waiting on condition [0..0]
          [junit]
          [junit] "Finalizer" daemon prio=1 tid=0x08096d60 nid=0x31e in Object.wait() [9ec74000..9ec7486c]
          [junit]     at java.lang.Object.wait(Native Method)
          [junit]     at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
          [junit]     - locked <0xa0282c08> (a java.lang.ref.ReferenceQueue$Lock)
          [junit]     at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
          [junit]     at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
          [junit]
          [junit] "Reference Handler" daemon prio=1 tid=0x08095320 nid=0x31e in Object.wait() [9ecf5000..9ecf586c]
          [junit]     at java.lang.Object.wait(Native Method)
          [junit]     - waiting on <0xa0282c70> (a java.lang.ref.Reference$Lock)
          [junit]     at java.lang.Object.wait(Object.java:429)
          [junit]     at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
          [junit]     - locked <0xa0282c70> (a java.lang.ref.Reference$Lock)
          [junit]
          [junit] "main" prio=1 tid=0x0805fbc0 nid=0x31e in Object.wait() [bfff9000..bfffa8cc]
          [junit]     at java.lang.Object.wait(Native Method)
          [junit]     - waiting on <0xa0ee54c0> (a EDU.oswego.cs.dl.util.concurrent.PooledExecutor)
          [junit]     at java.lang.Object.wait(Object.java:429)
          [junit]     at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.awaitTerminationAfterShutdown(PooledExecutor.java:651)
          [junit]     - locked <0xa0ee54c0> (a EDU.oswego.cs.dl.util.concurrent.PooledExecutor)
          [junit]     at com.atlassian.jira.action.admin.DataImport.shutdownPoolIfNotNull(DataImport.java:213)
          [junit]     at com.atlassian.jira.action.admin.DataImport.doExecute(DataImport.java:123)
          [junit]     at webwork.action.ActionSupport.execute(ActionSupport.java:153)
          [junit]     at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:58)
          [junit]     at com.atlassian.jira.action.JiraNonWebActionSupport.execute(JiraNonWebActionSupport.java:27)
          [junit]     at test.local.jira.action.admin.TestDataImport.testExecute(TestDataImport.java:121)
          [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          [junit]     at java.lang.reflect.Method.invoke(Method.java:324)
          [junit]     at junit.framework.TestCase.runTest(TestCase.java:154)
          [junit]     at junit.framework.TestCase.runBare(TestCase.java:127)
          [junit]     at junit.framework.TestResult$1.protect(TestResult.java:106)
          [junit]     at junit.framework.TestResult.runProtected(TestResult.java:124)
          [junit]     at junit.framework.TestResult.run(TestResult.java:109)
          [junit]     at junit.framework.TestCase.run(TestCase.java:118)
          [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:208)
          [junit]     at junit.framework.TestSuite.run(TestSuite.java:203)
          [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:332)
          [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:611)
      

              Assignee:
              Chris Mountford
              Reporter:
              Dylan Etkin [Atlassian]
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified