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:org.bibsonomy.webapp.util.TeerGrube.java

/**
 * Default constructor.//from  ww  w.jav  a 2s.  c om
 */
public TeerGrube() {
    log.info("New instance of TeerGrube created.");
    waitQueue = Collections.synchronizedMap(new HashMap<String, WaitingEntity>());
}

From source file:org.oscarehr.provider.model.PreventionManager.java

public PreventionManager() {
    demoPrevs = new LRUMap(MAXITEMS);
    mShell = new HashMap<String, LRUMap>(1);
    mShell.put(PREVS, demoPrevs);/*  www. j  a va  2 s.  com*/
    mShell = Collections.synchronizedMap(mShell);
    pf = PreventionDS.getInstance();
}

From source file:strat.mining.multipool.stats.service.impl.RequestStatsLoggingServiceImpl.java

public RequestStatsLoggingServiceImpl() {
    nbCurrencyTicker = new AtomicInteger(0);
    nbDonnation = new AtomicInteger(0);
    nbBlockchainDetails = new AtomicInteger(0);
    nbAllExchangePlace = new AtomicInteger(0);

    currencyTickerRequest = Collections.synchronizedMap(new HashMap<String, Map<String, AtomicInteger>>());
    donatorsRequests = Collections.synchronizedMap(new HashMap<String, AtomicInteger>());
}

From source file:org.kepler.gui.ModelToFrameManager.java

/**
 * Empty constructor/* ww w.j  a v a2 s .c  o  m*/
 */
public ModelToFrameManager() {
    HashMap<NamedObj, KeplerGraphFrame> hashMap = new HashMap<NamedObj, KeplerGraphFrame>();
    modelToFrameMap = Collections.synchronizedMap(hashMap);
    if (isDebugging) {
        log.debug("Constructing ModelToFrameManager");
    }
}

From source file:io.strandberg.xadisk.XADiskSessionFactory.java

@Autowired
public XADiskSessionFactory(JtaTransactionManager jtaTransactionManager,
        StandaloneFileSystemConfiguration standaloneFileSystemConfiguration) throws InterruptedException {
    this.transactionManager = jtaTransactionManager.getTransactionManager();
    this.standaloneFileSystemConfiguration = standaloneFileSystemConfiguration;
    xaSessionMap = Collections.synchronizedMap(new WeakHashMap<Transaction, XASession>());
}

From source file:au.com.jwatmuff.genericdb.cache.CachingDatabase.java

@SuppressWarnings("unchecked")
private Map getCache(Class c) {
    if (!caches.containsKey(c))
        caches.put(c, Collections.synchronizedMap(new LRUMap(1000)));
    return caches.get(c);
}

From source file:org.apache.torque.engine.database.model.Index.java

/**
 * Creates a new instance with default characteristics (no name or
 * parent table, small column list size allocation, non-unique).
 *//* w w w  .ja va 2 s  . c om*/
public Index() {
    indexColumns = new ArrayList(3);
    options = Collections.synchronizedMap(new ListOrderedMap());
}

From source file:org.wallerlab.yoink.adaptive.smooth.DASWeightFactors.java

/**
 * use smooth factors to calculate the weight factors.
 * @param job -parameters and results in job
 *//* w w w  . j a  v a  2  s.  c om*/
public void smooth(Job<JAXBElement> job) {
    // initialize
    Set<Molecule> bufferMolecules = job.getRegions().get(Region.Name.BUFFER).getMolecules();
    List<Integer> bufferIndices = new ArrayList<Integer>();
    for (Molecule molecule : bufferMolecules) {
        bufferIndices.add(molecule.getIndex());
    }
    List<Double> lambda = (List<Double>) job.getProperties().get("smoothfactors");
    Map<List<Integer>, Double> molecularIndicesAndWeightFactor = new HashMap<List<Integer>, Double>();
    molecularIndicesAndWeightFactor = Collections.synchronizedMap(molecularIndicesAndWeightFactor);
    // loop over all QM/MM sets in buffer region
    loopOverAllQMMMConfigurationsInBuffer(lambda, bufferIndices, molecularIndicesAndWeightFactor);
    job.getProperties().put("weightfactors", molecularIndicesAndWeightFactor);
}

From source file:com.chingo247.structureapi.schematic.SchematicManager.java

private SchematicManager() {
    this.graph = SettlerCraft.getInstance().getNeo4j();
    this.schematicRepository = new SchematicRepository(graph);
    this.schematics = Collections.synchronizedMap(new HashMap<Long, Schematic>());
}

From source file:org.jinzora.util.DrawableManager.java

public DrawableManager(Context context) {
    drawableMap = Collections.synchronizedMap(new HashMap<String, SoftReference<Drawable>>());
    pendingViews = new HashMap<ImageView, String>();
    THUMB_DIR = getThumbDirectory(context);
}