Example usage for java.util.concurrent ConcurrentNavigableMap remove

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

Introduction

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

Prototype

V remove(Object key);

Source Link

Document

Removes the mapping for a key from this map if it is present (optional operation).

Usage

From source file:actions.DownloadSPDX.java

/**
 * Removes a repository from our queue/*w  w  w  .  j  av  a2  s  .  c  o m*/
 * @param repository    A repository line as extracted from the text file
 */
private void queueRemove(final String repository) {
    // this is a good moment to save a recovery point right here
    ConcurrentNavigableMap<String, Long> map = dbQueue.getTreeMap("queue");
    // put on the database, if it is already there then it gets overwritten
    map.remove(repository);
    dbQueue.commit();
}

From source file:org.apache.sling.models.impl.AdapterImplementations.java

/**
 * Remove implementation mapping for the given adapter type.
 * @param adapterTypeName Adapter type name
 * @param implTypeName Implementation type name
 */// ww  w.  j a va 2s .  c o m
public void remove(String adapterTypeName, String implTypeName) {
    String key = adapterTypeName;
    if (StringUtils.equals(adapterTypeName, implTypeName)) {
        modelClasses.remove(key);
    } else {
        // although we already use a ConcurrentMap synchronize explicitly because we apply non-atomic operations on it
        synchronized (adapterImplementations) {
            ConcurrentNavigableMap<String, ModelClass<?>> implementations = adapterImplementations.get(key);
            if (implementations != null) {
                implementations.remove(implTypeName);
                if (implementations.isEmpty()) {
                    adapterImplementations.remove(key);
                }
            }
        }
    }
}