You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2014/04/26 13:39:18 UTC

svn commit: r1590227 - /uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java

Author: schor
Date: Sat Apr 26 11:39:17 2014
New Revision: 1590227

URL: http://svn.apache.org/r1590227
Log:
[UIMA-3774] handle case of table resize while waiting slightly better

Modified:
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java?rev=1590227&r1=1590226&r2=1590227&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java Sat Apr 26 11:39:17 2014
@@ -204,13 +204,16 @@ public class JCasHashMap {
             while (((TOP) maybe).jcasType == null) {
               // we hit a reserve marker - there is another thread in the process of creating an instance of this,
               // so wait for it to finish and then return it
+              final int sizeNow = size;
               try {
                 wait();  // releases the synchronized monitor, otherwise this segment blocked for others while waiting
               } catch (InterruptedException e) {
               }
-              // at this point, the table may have grown
-              // so start over
-              continue retryAfterWait;
+              if (size != sizeNow) {
+                // at this point, the table may have grown
+                // so start over
+                continue retryAfterWait;
+              }
             }
             if (TUNE) {
               histogram[Math.min(histogram.length - 1, nbrProbes)]++;