tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ohad Shacham <>
Subject ConcurrentCache atomicity violation
Date Tue, 15 Jun 2010 14:26:49 GMT

We are writing a tool to detect atomicity violations in usage of

We have run the tool that reported an atomicity violation in functions get
and put of class ConcurrentCache.

The following code shows the put function of the ConcurrentCache:

    public void put(K k, V v) {

        if (this.eden.size() >= size) {




        this.eden.put(k, v);


In this code the tool discovered a scenario that a (k,v) pair is added to
eden and a clear operation deletes this pair without copying it to the
longterm hash.

We would be happy if you can let us know if this is a bug or this is a valid
behavior of the cache.

Another problem is that longterm is a WeakHashMap which is not a thread safe



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message