Example usage for java.util.concurrent ConcurrentMap keySet

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

Introduction

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

Prototype

Set<K> keySet();

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:com.opengamma.component.ComponentConfigLoader.java

/**
 * Extracts any properties that start with "INI.".
 * <p>//from  www. j  a v  a2 s.co m
 * These directly override any INI file settings.
 * 
 * @param properties  the properties, not null
 * @return the extracted set of INI properties, not null
 */
private Map<String, String> extractIniProperties(ConcurrentMap<String, String> properties) {
    Map<String, String> extracted = new HashMap<String, String>();
    for (String key : properties.keySet()) {
        if (key.startsWith("INI.") && key.substring(4).contains(".")) {
            extracted.put(key.substring(4), properties.get(key));
        }
    }
    return extracted;
}

From source file:com.opengamma.component.ComponentConfigLoader.java

private ConcurrentMap<String, String> adjustProperties(ConcurrentMap<String, String> input) {
    ConcurrentMap<String, String> map = new ConcurrentHashMap<String, String>();
    for (String key : input.keySet()) {
        map.put("${" + key + "}", input.get(key));
    }//ww  w.j ava2  s. com
    return map;
}

From source file:org.opendaylight.ovsdb.plugin.internal.NodeDatabase.java

public void printTableCache() {
    for (String dbName : dbCache.keySet()) {
        System.out.println("Database " + dbName);
        ConcurrentMap<String, ConcurrentMap<String, Row>> tableDB = this.getDatabase(dbName);
        if (tableDB == null) {
            continue;
        }//from   ww w.j  av  a 2s  .  c  o m
        for (String tableName : tableDB.keySet()) {
            ConcurrentMap<String, Row> tableRows = this.getTableCache(dbName, tableName);
            System.out.println("\tTable " + tableName);
            for (String uuid : tableRows.keySet()) {
                Row row = tableRows.get(uuid);
                Collection<Column> columns = row.getColumns();
                System.out.print("\t\t" + uuid + "==");
                for (Column column : columns) {
                    if (column.getData() != null) {
                        System.out.print(column.getSchema().getName() + " : " + column.getData() + " ");
                    }
                }
                System.out.println("");
            }
            System.out.println("-----------------------------------------------------------");
        }
    }
}

From source file:com.adobe.acs.commons.httpcache.store.caffeine.impl.CaffeineMemHttpCacheStoreImpl.java

@Override
public void invalidate(HttpCacheConfig cacheConfig) {
    ConcurrentMap<CacheKey, MemCachePersistenceObject> cacheAsMap = cache.asMap();
    for (CacheKey key : cacheAsMap.keySet()) {
        // Match the cache key with cache config.
        try {/*from w w w.j ava2 s  . co m*/
            if (cacheConfig.knows(key)) {
                // If matches, invalidate that particular key.
                cache.invalidate(key);
            }
        } catch (HttpCacheKeyCreationException e) {
            log.error("Could not invalidate HTTP cache. Falling back to full cache invalidation.", e);
            this.invalidateAll();
        }
    }
}

From source file:com.adobe.acs.commons.httpcache.store.caffeine.impl.CaffeineMemHttpCacheStoreImpl.java

@Override
public void invalidate(CacheKey invalidationKey) {
    final ConcurrentMap<CacheKey, MemCachePersistenceObject> cacheAsMap = cache.asMap();

    for (CacheKey key : cacheAsMap.keySet()) {
        if (key.isInvalidatedBy(invalidationKey)) {
            cache.invalidate(key);/*from   www . jav  a  2 s.c  o  m*/
        }
    }
}

From source file:net.cit.tetrad.rrd.batch.TetradRrdInitializer.java

public void input() throws Exception {
    try {//from w ww.  ja va  2 s.co  m
        // ?    ?
        ConcurrentMap<Integer, Device> deviceGroup = DeviceInMemory.getDeviceGroup();

        //  ? 
        int logGenerationIntervalSeconds = RrdUtil.readLogGenerationInterval();

        Set<Integer> keys = deviceGroup.keySet();
        Object[] objKeys = keys.toArray();
        if (objKeys != null) {
            Arrays.sort(objKeys, Utility.codeKeySort);
            int thredIndex = 1;
            for (int i = 0; i < objKeys.length; i++) {
                int deviceIdx = (Integer) objKeys[i];
                Config.g_inc.put(thredIndex, 0);
                TetradInputThread inputThread = new TetradInputThread(deviceIdx, logGenerationIntervalSeconds,
                        tetradRrdDbService, thredIndex);
                inputThread.start();
                thredIndex++;
                Config.totalThreadCount++;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:com.fhzz.dubbo.service.impl.ConsumerServiceImpl.java

public List<String> findServices() {
    List<String> ret = new ArrayList<String>();
    ConcurrentMap<String, Map<Long, URL>> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
    if (consumerUrls != null)
        ret.addAll(consumerUrls.keySet());
    return ret;//ww  w . j  a va  2s  . co  m
}

From source file:com.bt.aloha.fitnesse.OutboundCallFixture.java

public String cleanCallCollection() {
    ConcurrentMap<String, CallInfo> calls = getCallCollection().getAll();
    for (String callId : calls.keySet()) {
        getCallCollection().remove(callId);
    }/*  w w  w .  j av a 2 s.  c  o m*/
    if (getCallCollection().size() == 0)
        return "OK";
    else
        return "Failed";
}

From source file:com.bt.aloha.fitnesse.ConferenceFixture.java

public String cleanConferenceCollection() {
    ConcurrentMap<String, ConferenceInfo> conferences = conferenceCollection.getAll();
    for (String conferenceId : conferences.keySet()) {
        conferenceCollection.remove(conferenceId);
    }/*ww  w.j  a  va 2s  . c  o  m*/
    if (conferenceCollection.size() == 0)
        return "OK";
    else
        return "Failed";
}

From source file:org.sakaiproject.memory.impl.GenericMultiRefCacheImpl.java

/**
 * Complete the update, given an event that we know we need to act upon.
 *
 * @param event//  w w  w.  ja v  a2  s .c o  m
 *        The event to process.
 */
protected void continueUpdate(Event event) {
    String ref = event.getResource();

    if (M_log.isDebugEnabled())
        M_log.debug("continueUpdate() [" + m_resourcePattern + "] resource: " + ref + " event: "
                + event.getEvent());

    // get the copy of the Collection of cache keys for this reference (the actual collection will be reduced as the removes occur)
    ConcurrentMap<Object, Object> cachedKeys = m_refsStore.get(ref);
    if (cachedKeys != null) {
        Set<Object> keySet = cachedKeys.keySet();
        for (Iterator<Object> iKeys = keySet.iterator(); iKeys.hasNext();) {
            Object key = iKeys.next();
            remove(String.valueOf(key));

            if (M_log.isDebugEnabled()) {
                M_log.debug("Removed from cache: " + key);
            }
        }
    }
}