Example usage for java.util.concurrent ConcurrentHashMap remove

List of usage examples for java.util.concurrent ConcurrentHashMap remove

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap remove.

Prototype

public boolean remove(Object key, Object value) 

Source Link

Usage

From source file:org.getobjects.ofs.fs.OFSFileManager.java

public Object getCachedObject(final String _section, IOFSFileInfo _info) {
    if (_section == null || _info == null)
        return null;

    final ConcurrentHashMap<IOFSFileInfo, Object> sectionCache = this.objectCache.get(_section);
    if (sectionCache == null)
        return null;

    CacheNode entry = (CacheNode) sectionCache.get(_info);
    if (entry == null)
        return null;

    /* validate entry */

    Object newETag = this.etagFromFileInfo(_info);
    if (newETag == entry.etag)
        return entry.object; /* still valid */

    if (newETag == null || entry.etag == null || !(newETag.equals(entry.etag))) {
        /* expire entry if its still the same entry in the cache */
        sectionCache.remove(_info, entry);
        return null;
    }/*from   w  ww  .j  a va2  s  . com*/

    /* still valid */
    return entry.object;
}