JavaNativeMethodImpl_OpenJDK7.st
branchdevelopment
changeset 2958 bbd626006ab0
parent 2926 223fb480e1fb
child 2959 3e837849ce3e
--- a/JavaNativeMethodImpl_OpenJDK7.st	Sun Dec 08 22:36:37 2013 +0000
+++ b/JavaNativeMethodImpl_OpenJDK7.st	Mon Dec 09 23:52:18 2013 +0000
@@ -398,12 +398,23 @@
         ^ 0
     ] ifFalse: [
         ^ ZipEntryCache indexOf: member ifAbsent:[
-            ZipEntryCache add: member.
-            ZipEntryCache size.
-        ]
+            | index |
+
+            ZipEntryCacheLock critical:[
+                ZipEntryCacheFirstFree == 0 ifTrue:[
+                    ZipEntryCache add: member.
+                    index := ZipEntryCache size.
+                ] ifFalse:[
+                    index := ZipEntryCacheFirstFree.
+                    ZipEntryCacheFirstFree := ZipEntryCache at: index.
+                    ZipEntryCache at: index put: member.
+                ].
+            ].
+            index.
+        ].
     ]
 
-    "Modified: / 11-02-2013 / 12:45:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-12-2013 / 23:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _java_util_zip_ZipFile_getEntryBytes: this _: jzentry _: a2 _: type