All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fabric3.cache.runtime.CacheRegistryImpl Maven / Gradle / Ivy

package org.fabric3.cache.runtime;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.oasisopen.sca.annotation.Reference;

import org.fabric3.cache.spi.CacheManager;
import org.fabric3.cache.spi.CacheResourceDefinition;

/**
 *
 */
public class CacheRegistryImpl implements CacheRegistry {
    private Map, CacheManager> managers = new ConcurrentHashMap, CacheManager>();

    @Reference(required = false)
    public void setManagers(Map, CacheManager> managers) {
        this.managers = managers;
    }

    @SuppressWarnings({"unchecked"})
    public  CACHE getCache(String name) {
        for (CacheManager manager : managers.values()) {
            Object cache = manager.getCache(name);
            if (cache != null) {
                return (CACHE) cache;
            }
        }
        return null;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy