Example usage for com.google.common.collect Maps newConcurrentMap

List of usage examples for com.google.common.collect Maps newConcurrentMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newConcurrentMap.

Prototype

public static <K, V> ConcurrentMap<K, V> newConcurrentMap() 

Source Link

Document

Returns a general-purpose instance of ConcurrentMap , which supports all optional operations of the ConcurrentMap interface.

Usage

From source file:qa.qcri.nadeef.core.pipeline.Updater.java

/**
 * Constructor.
 */
public Updater(ExecutionContext context) {
    super(context);
    updateHistory = Maps.newConcurrentMap();
    unknownTag = Maps.newConcurrentMap();
}

From source file:com.infinities.skyport.distributed.impl.local.LocalCache.java

public LocalCache() {
    this.e = new IllegalStateException("cache not initialized yet");
    this.map = Maps.newConcurrentMap();
}

From source file:org.pentaho.caching.spi.AbstractCacheManager.java

public AbstractCacheManager() {
    managedCacheMap = Maps.newConcurrentMap();
}

From source file:nl.knaw.huygens.timbuctoo.storage.file.UserFileCollection.java

public UserFileCollection(List<User> users) {
    // I'm not sure if this is needed, better safe than sorry.
    idUserMap = Maps.newConcurrentMap();
    persistentIdIdMap = Maps.newConcurrentMap();
    initialize(users);//from  w  w w  .  j a va  2  s  . c om
}

From source file:org.geogit.storage.memory.HeapObjectDatabse.java

/**
 * Opens the database for use by GeoGit.
 */// w ww  . jav a2 s  .  co m
@Override
public void open() {
    if (isOpen()) {
        return;
    }
    Map<ObjectId, byte[]> map = Maps.newConcurrentMap();
    objects = Collections.synchronizedMap(map);
}

From source file:org.apache.isis.core.metamodel.specloader.InjectorMethodEvaluatorDefault.java

public boolean isInjectorMethodFor(final Method method, final Class<?> serviceClass) {

    // there's no need to synchronize this access.
    // if there were a race condition, then at worst a result of the determineXxx method might be discard
    // (but it would end up being calculated next time around)

    Map<Class<?>, Boolean> classBooleanMap = isInjectorMethod.get(method);
    if (classBooleanMap == null) {
        classBooleanMap = Maps.newConcurrentMap();
        isInjectorMethod.put(method, classBooleanMap);
    }//ww  w .  j av  a2s. c  om
    Boolean result = classBooleanMap.get(serviceClass);
    if (result == null) {
        result = determineIsInjectorMethodFor(method, serviceClass);
        classBooleanMap.put(serviceClass, result);
    }
    return result;
}

From source file:org.rakam.presto.stream.storage.StreamStorageManager.java

@Inject
public StreamStorageManager(@ForMetadata IDBI dbi, QueryAnalyzer queryAnalyzer) {
    this.tables = Maps.newConcurrentMap();
    this.dao = dbi.onDemand(MetadataDao.class);
    this.queryAnalyzer = queryAnalyzer;
    //        schemas = DBMaker.newFileDB(new File("./test")).make();
}

From source file:org.opendaylight.netvirt.federation.plugin.PendingModificationCache.java

public <T extends DataObject> void add(T dataObject, String listenerKey, M modification) {
    String identifier = extractLiberatorIdentifier(dataObject);
    if (identifier == null) {
        return;/*from  ww w .  ja v  a  2 s .  com*/
    }

    synchronized (pendingModifications) {
        Map<String, Collection<M>> modificationMap = pendingModifications.getIfPresent(identifier);
        if (modificationMap == null) {
            modificationMap = Maps.newConcurrentMap();
            pendingModifications.put(identifier, modificationMap);
        }

        Collection<M> listenerModifications = modificationMap.get(listenerKey);
        if (listenerModifications == null) {
            listenerModifications = new LinkedBlockingQueue<>();
            modificationMap.put(listenerKey, listenerModifications);
        }

        listenerModifications.add(modification);
    }
}

From source file:org.onosproject.incubator.net.virtual.event.VirtualListenerRegistryManager.java

public ListenerRegistry getRegistry(NetworkId networkId, Class<? extends Event> eventClass) {
    Map<Class<? extends Event>, ListenerRegistry> listenerMapByEvent = listenerMapByNetwork.get(networkId);

    if (listenerMapByEvent == null) {
        listenerMapByEvent = Maps.newConcurrentMap();
        listenerMapByNetwork.putIfAbsent(networkId, listenerMapByEvent);
    }/*from  www  .java  2  s.  c om*/

    ListenerRegistry listenerRegistry = listenerMapByEvent.get(eventClass);

    if (listenerRegistry == null) {
        listenerRegistry = new ListenerRegistry();
        listenerMapByEvent.putIfAbsent(eventClass, listenerRegistry);
    }

    return listenerRegistry;
}

From source file:org.ros.internal.message.new_style.ServiceFactory.java

public ServiceFactory(ServiceLoader serviceLoader, MessageFactory messageFactory) {
    this.serviceLoader = serviceLoader;
    this.messageFactory = messageFactory;
    requestMessageClassRegistry = DefaultedClassMap.newFromDefaultClass(Service.Request.class);
    responseMessageClassRegistry = DefaultedClassMap.newFromDefaultClass(Service.Response.class);
    requestDefinitions = Maps.newConcurrentMap();
    responseDefinitions = Maps.newConcurrentMap();
}