Java Code Examples for net.sf.ehcache.Cache#getKeys()

The following examples show how to use net.sf.ehcache.Cache#getKeys() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BounceProxyEhcacheAdapter.java    From joynr with Apache License 2.0 6 votes vote down vote up
@Override
public List<BounceProxyRecord> getAssignableBounceProxies() {

    if (log.isTraceEnabled()) {
        log.trace("Retrieving assignable bounce proxies from cache {}", cacheName);
        tracePeers();
    }

    List<BounceProxyRecord> result = new LinkedList<BounceProxyRecord>();

    Cache cache = manager.getCache(cacheName);

    @SuppressWarnings("rawtypes")
    List keys = cache.getKeys();
    Map<Object, Element> elements = cache.getAll(keys);

    for (Element element : elements.values()) {
        BounceProxyRecord bounceProxyRecord = getBounceProxyRecordFromElement(element);
        if (bounceProxyRecord.getStatus().isAssignable()) {
            result.add(bounceProxyRecord);
        }
    }

    return result;
}
 
Example 2
Source File: BounceProxyEhcacheAdapter.java    From joynr with Apache License 2.0 6 votes vote down vote up
@Override
public List<BounceProxyStatusInformation> getBounceProxyStatusInformation() {

    if (log.isTraceEnabled()) {
        log.trace("getBounceProxyStatusInformation from cache {}", cacheName);
        tracePeers();
    }

    List<BounceProxyStatusInformation> result = new LinkedList<BounceProxyStatusInformation>();

    Cache cache = manager.getCache(cacheName);
    @SuppressWarnings("rawtypes")
    List keys = cache.getKeys();
    Map<Object, Element> elements = cache.getAll(keys);

    for (Element element : elements.values()) {
        result.add(getBounceProxyRecordFromElement(element));
    }

    return result;
}