]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Must synchronize on cacheMap when removing DataObjectCache instance.
authorAdrian Cumiskey <acumiskey@apache.org>
Mon, 21 Jul 2008 12:58:18 +0000 (12:58 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Mon, 21 Jul 2008 12:58:18 +0000 (12:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678405 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/afp/DataObjectCache.java

index f2631f0cd9e676c4e4a51c75d48af64b2f8c4a0d..c8129baf284bfa9fb46129d28a4f51e802df2e4c 100644 (file)
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
+import java.util.Collections;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -48,6 +49,7 @@ public final class DataObjectCache {
     private static Map/*<Integer,DataObjectCache>*/ cacheMap
         = new java.util.HashMap/*<Integer,DataObjectCache>*/();    
     
+    
     /** Mapping of data object uri --> cache record */
     private Map/*<ResourceInfo,Record>*/ includableMap
         = new java.util.HashMap/*<ResourceInfo,Record>*/();
@@ -110,7 +112,9 @@ public final class DataObjectCache {
         try {
             raFile.close();
             tempFile.delete();
-            cacheMap.remove(id); // remove ourselves from the cache map
+            synchronized (cacheMap) {
+                cacheMap.remove(id); // remove ourselves from the cache map
+            }
         } catch (IOException e) {
             log.error("Failed to close temporary file");
         }