Example usage for java.util.concurrent ConcurrentSkipListMap keySet

List of usage examples for java.util.concurrent ConcurrentSkipListMap keySet

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListMap keySet.

Prototype

KeySet keySet

To view the source code for java.util.concurrent ConcurrentSkipListMap keySet.

Click Source Link

Document

Lazily initialized key set

Usage

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

/**
 * ?/*from  ww w . j  a  v a2 s.  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:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java

private void pruneCache() {
    String expireTime = LocalDateTime.now().minusHours(ttl).format(Util.timeFormatter);
    log.info("{expireTime:{}}", expireTime);

    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();
                if (timesplices.compareTo(expireTime) < 0) {
                    columnMap.get(timesplices).clear();
                    iterator.remove();//from   w  w w  . ja v  a  2s.  com
                } else {
                    break;
                }
            }
        }
    }

}