From 84088d311defd5c69d1a8504ef7cf32dbd7cbcae Mon Sep 17 00:00:00 2001
From: Paul Stadig <paul@stadig.name>
Date: Sat, 9 Feb 2013 07:01:28 -0500
Subject: [PATCH] CCACHE-28: fixes concurrency bug in has?

We were allowing for another thread to add an item to the cache after we'd
already tried to pull out the SoftReference.  Since the SoftReference had been
pulled out before the item was added, it was nil, but since contains? returned
true, we assumed that it was not nil.
---
 src/main/clojure/clojure/core/cache.clj |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/clojure/clojure/core/cache.clj b/src/main/clojure/clojure/core/cache.clj
index e7a4e8c..21df562 100644
--- a/src/main/clojure/clojure/core/cache.clj
+++ b/src/main/clojure/clojure/core/cache.clj
@@ -511,8 +511,7 @@
   (has? [_ item]
     (let [item (or item ::nil)
           ^SoftReference cell (get cache item)]
-      (and (contains? cache item)
-           (not (nil? (.get cell))))))
+      (and cell (.get cell))))
   (hit [this item]
     (clear-soft-cache! cache rcache rq)
     this)
-- 
1.7.9.5

