Example usage for java.util Collections synchronizedMap

List of usage examples for java.util Collections synchronizedMap

Introduction

In this page you can find the example usage for java.util Collections synchronizedMap.

Prototype

public static <K, V> Map<K, V> synchronizedMap(Map<K, V> m) 

Source Link

Document

Returns a synchronized (thread-safe) map backed by the specified map.

Usage

From source file:epgtools.epgdbbean.bean.channel.ChannelGetter.java

/**
 * DB?????????// w ww.java  2  s  . c  o m
 *
 * @return ??????(??) ?????
 * @throws java.sql.SQLException
 */
public synchronized Map<Integer, Useablechannels_ReadOnly> getChannels() throws SQLException {
    //?
    Map<Integer, Useablechannels> Channels;
    Channels = Collections.synchronizedMap(runner.query(con, ChannelGetter.GET_CHANNELS,
            new BeanMapHandler<Integer, Useablechannels>(Useablechannels.class, "channel_no")));
    Map<Integer, Useablechannels_ReadOnly> Channels_Ro;
    Channels_Ro = Collections.synchronizedMap(new TreeMap<Integer, Useablechannels_ReadOnly>());
    Channels_Ro.putAll(Channels);
    return Collections.unmodifiableMap(Channels_Ro);
}

From source file:org.openehealth.ipf.platform.camel.flow.PlatformFlowManager.java

/**
 * Creates a new {@link PlatformFlowManager}.
 *//*from ww  w .  j a v  a2  s  . c  o m*/
public PlatformFlowManager() {
    replayStrategies = Collections.synchronizedMap(new HashMap<String, ReplayStrategy>());
}

From source file:org.rhq.core.util.obfuscation.PropertyObfuscationVault.java

@Override
public void init(Map<String, Object> options) throws SecurityVaultException {
    this.options = Collections.synchronizedMap(new HashMap<String, Object>());
    this.options.putAll(options);
}

From source file:org.romaframework.aspect.view.form.FormViewer.java

protected FormViewer() {
    sessionManager = Roma.session();//from  w  w  w .ja va2 s.  c  o  m
    userView = Collections.synchronizedMap(new HashMap<Object, Screen>());

    Controller.getInstance().registerListener(SessionListener.class, this);
}

From source file:org.apache.roller.weblogger.util.cache.LRUCacheImpl.java

protected LRUCacheImpl(String id, int maxsize) {

    this.id = id;
    this.cache = Collections.synchronizedMap(new LRULinkedHashMap(maxsize));
}

From source file:be.fedict.trust.crl.CachedCrlRepository.java

/**
 * Main constructor./*from   w ww. j  a v a2s.  c  o m*/
 * 
 * @param crlRepository
 *            the delegated CRL repository.
 */
public CachedCrlRepository(CrlRepository crlRepository) {
    this.crlRepository = crlRepository;
    this.crlCache = Collections.synchronizedMap(new HashMap<URI, SoftReference<X509CRL>>());
    this.cacheAgingHours = DEFAULT_CACHE_AGING_HOURS;
}

From source file:org.rifidi.services.initializer.InitService.java

/**
 * Constructor./*from   w  w w  . j ava 2 s  .com*/
 */
public InitService() {
    logger.debug("InitService created");
    initMap = Collections.synchronizedMap(new HashMap<Class, IInitializer>());
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    registry.addRegistryChangeListener(this, "org.rifidi.services.initializer");
    point = registry.getExtensionPoint("org.rifidi.services.initializer");
    if (point == null) {
        logger.fatal("Extension point org.rifidi.services.initializer missing!!");
        return;
    }
    for (IExtension extension : point.getExtensions()) {
        getInitializers(extension, true);
    }
}

From source file:ezbake.security.impl.cache.MemoryCache.java

/**
 *
 * @param capacity//from www  . j a v a 2  s  .  c  o  m
 * @param expiration in seconds
 */
public MemoryCache(final int capacity, final long expiration) {
    // Enforce greater than zero policy
    int cap = (capacity > 0) ? capacity : DEFAULT_MAX_CAPACITY;
    long exp = (expiration > 0) ? expiration : DEFAULT_CACHE_EXPIRATION;

    lruCache = (Map<Key, CacheValue<Value>>) Collections.synchronizedMap(new LRUMap(cap));
    this.expiration = exp * 1000;

    log.debug("Initialized EzSecurity Cache\ncap:{}\nexp:{}", cap, exp);
}

From source file:org.pentaho.platform.engine.core.system.SimpleMapCacheManager.java

public SimpleMapCacheManager() {
    simpleMap = Collections.synchronizedMap(new HashMap());
    PentahoSystem.addLogoutListener(this);
}

From source file:com.jaspersoft.jasperserver.war.common.JdkTimeZonesList.java

public JdkTimeZonesList() {
    userTimeZonesLists = Collections.synchronizedMap(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
}