Example usage for java.util.concurrent ConcurrentHashMap clear

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

Introduction

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

Prototype

public void clear() 

Source Link

Document

Removes all of the mappings from this map.

Usage

From source file:com.ebay.pulsar.sessionizer.impl.SessionizerErrorManager.java

@ManagedOperation
public void cleanErrors() {
    for (ConcurrentHashMap<String, LongCounter> v : errorCounterMap.values()) {
        v.clear();
    }/* ww w . ja v a  2s .  c om*/
    errorCount.set(0);
    m_errors.clearErrorList();
}

From source file:com.taobao.common.tedis.cache.DefaultLocalCache.java

public boolean clear() {
    if (caches != null)
        for (ConcurrentHashMap<K, SoftReference<V>> cache : caches) {
            cache.clear();
        }//  w w w.  jav  a2  s.  c o m

    if (expiryCache != null) {
        expiryCache.clear();
    }

    return true;
}

From source file:com.guang.eunormia.common.cache.DefaultLocalCache.java

@Override
public boolean clear() {
    if (caches != null)
        for (ConcurrentHashMap<K, SoftReference<V>> cache : caches) {
            cache.clear();
        }/*  w w  w  . j av  a  2  s .  c  o m*/

    if (expiryCache != null) {
        expiryCache.clear();
    }

    return true;
}

From source file:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java

/**
 * ?//from ww w .j a va 2s  . c o m
 */
public void clear() {
    for (String rowKey : table.keySet()) {
        ConcurrentHashMap<String, ConcurrentSkipListMap<String, ConcurrentSet<T>>> rowMap = table.get(rowKey);
        for (String columnKey : rowMap.keySet()) {
            ConcurrentSkipListMap<String, ConcurrentSet<T>> columnMap = rowMap.get(columnKey);

            Iterator<String> iterator = columnMap.keySet().iterator();
            while (iterator.hasNext()) {
                String timesplices = iterator.next();
                columnMap.get(timesplices).clear();
                iterator.remove();
            }

        }
        rowMap.clear();
    }

    table.clear();
}

From source file:org.waarp.common.filemonitor.FileMonitor.java

/**
 * /*from  ww w .jav a 2  s . co m*/
 * @return the status (updated only) in JSON format
 */
public String getStatus() {
    Set<String> removedFileItems = null;
    ConcurrentHashMap<String, FileItem> newFileItems = new ConcurrentHashMap<String, FileMonitor.FileItem>();
    if (!lastFileItems.isEmpty()) {
        removedFileItems = lastFileItems.keySet();
        removedFileItems.removeAll(fileItems.keySet());
        for (Entry<String, FileItem> key : fileItems.entrySet()) {
            if (!key.getValue().isStrictlySame(lastFileItems.get(key.getKey()))) {
                newFileItems.put(key.getKey(), key.getValue());
            }
        }
    } else {
        for (Entry<String, FileItem> key : fileItems.entrySet()) {
            newFileItems.put(key.getKey(), key.getValue());
        }
    }
    FileMonitorInformation fileMonitorInformation = new FileMonitorInformation(name, newFileItems,
            removedFileItems, directories, stopFile, statusFile, elapseTime, scanSubDir, globalok, globalerror,
            todayok, todayerror);
    for (Entry<String, FileItem> key : fileItems.entrySet()) {
        FileItem clone = key.getValue().clone();
        lastFileItems.put(key.getKey(), clone);
    }
    createChkFile();
    String status = JsonHandler.writeAsString(fileMonitorInformation);
    if (removedFileItems != null) {
        removedFileItems.clear();
    }
    newFileItems.clear();
    return status;
}