Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Potential Unreleased Lock #53

Open
ananmika opened this issue May 5, 2016 · 0 comments
Open

Potential Unreleased Lock #53

ananmika opened this issue May 5, 2016 · 0 comments

Comments

@ananmika
Copy link

ananmika commented May 5, 2016

In V load(K key) method of org.ehcache.jcache.JCache class ehcache.acquireWriteLockOnKey(key) lock doesn't released when value exists.
Lock must be acquired if value not exists in cache.

V load(K key) {
        V value;
        final Element e = ehcache.get(key);
        if(e != null) {
            return (V)e.getObjectValue();
        }
        try {
            ehcache.acquireWriteLockOnKey(key);
            try {
                value = cacheLoader.load(key);
            } catch (Exception ex) {
                throw new CacheLoaderException(ex);
            }
            if(value != null) {
                putWithoutWriter(key, value);
            }
        } finally{
            ehcache.releaseWriteLockOnKey(key);
        }
        return value;
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant