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:framework.retrieval.engine.pool.impl.IndexReaderPool.java

public IndexReaderPool() {
    methodInterceptorPoolMap = Collections.synchronizedMap(new HashMap<String, IndexReaderProxy>());
    indexPathTypes = Collections.synchronizedSet(new HashSet<String>());
}

From source file:org.h3270.logicalunit.LogicalUnitPool.java

public LogicalUnitPool(LogicalUnitBuilder builder) {
    Collection logicalUnits = builder.getLogicalUnits();

    luPool = Collections.synchronizedMap(new HashMap(logicalUnits.size()));

    for (Iterator iter = logicalUnits.iterator(); iter.hasNext();) {
        String name = (String) iter.next();
        luPool.put(name, new Boolean(false));
    }// www  .  j  a  va  2s .  c  o m
}

From source file:cat.albirar.framework.dynabean.impl.DefaultDynaBeanFactory.java

/**
 * Default constructor.//  w w w. j av  a2  s.  c o m
 */
public DefaultDynaBeanFactory() {
    propRegistry = new SimpleTypeConverter();
    descriptors = Collections.synchronizedMap(new TreeMap<String, DynaBeanDescriptor<?>>());
}

From source file:org.apache.ambari.view.hive.resources.browser.HiveBrowserService.java

public static Map<String, Cursor> getResultsCache() {
    if (resultsCache == null) {
        PassiveExpiringMap<String, Cursor> resultsCacheExpiringMap = new PassiveExpiringMap<String, Cursor>(
                EXPIRING_TIME);//from  ww w .j  a  va2 s . c  om
        resultsCache = Collections.synchronizedMap(resultsCacheExpiringMap);
    }
    return resultsCache;
}

From source file:org.viafirma.nucleo.validacion.CrlCache.java

/**
* 
*//*w  w w  . j a  va  2s. c  o  m*/
private CrlCache() {
    // Creamos la cache sincronizada.
    cacheCrlsForCertificate = Collections.synchronizedMap(new HashMap<String, List<X509CRL>>());
}

From source file:cat.albirar.framework.sets.impl.ModelDescriptor.java

/**
 * Constructor for model./*  w  ww  .j av  a  2 s.c o  m*/
 * @param model The model, required
 * @throws IllegalArgumentException If model is null
 */
public ModelDescriptor(Class<?> model) {
    Assert.notNull(model, "The model is required");
    relativePath = "";
    originalPath = "";
    this.model = model;
    properties = Collections.synchronizedMap(new TreeMap<String, PropertyDescriptor>());
    resolveProperties();
}

From source file:com.musenkishi.wally.util.PaletteLoader.java

public static PaletteBuilder with(Context context, String id) {
    if (colorSchemeCache == null) {
        colorSchemeCache = Collections.synchronizedMap(new LRUMap<String, Palette>(MAX_ITEMS_IN_CACHE));
    }/*w  w  w.  j av a 2s . c o m*/
    if (uiHandler == null || backgroundHandler == null) {
        setupHandlers(context);
    }
    return new PaletteBuilder(id);
}

From source file:com.frostwire.gui.library.DeviceDiscoveryClerk.java

public DeviceDiscoveryClerk() {
    deviceCache = Collections.synchronizedMap(new HashMap<String, Device>());
    jsonEngine = new JsonEngine();
}

From source file:org.kuali.rice.ksb.service.impl.BasicAuthenticationServiceImpl.java

/**
 * Constructs BasicAuthenticationServiceImpl with a serviceCredentialsMap and a connectionCredentialsMap
 *///from  w  w  w  .j  ava  2  s.c o  m
public BasicAuthenticationServiceImpl() {
    this.serviceCredentialsMap = Collections
            .synchronizedMap(new HashMap<QName, List<BasicAuthenticationCredentials>>());
    this.connectionCredentialsMap = Collections
            .synchronizedMap(new HashMap<QName, BasicAuthenticationConnectionCredentials>());
}

From source file:org.ots.dns.NameStore.java

public synchronized void putLocal(String hostName, String ipAddress) {
    Map localThreadNames = (Map) localThread.get();
    if (localThreadNames == null) {
        localThreadNames = Collections.synchronizedMap(new HashMap());
        localThread.set(localThreadNames);
    }//from   www  .j  a v a2  s . c o  m
    localThreadNames.put(hostName, ipAddress);
}