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:org.ros.internal.message.definition.MessageDefinitionReflectionProvider.java

public MessageDefinitionReflectionProvider() {
    cache = Maps.newConcurrentMap();
}

From source file:com.metamx.druid.client.OnlyNewSegmentWatcherServerView.java

public OnlyNewSegmentWatcherServerView() {
    this.segmentCallbacks = Maps.newConcurrentMap();
}

From source file:org.ros.internal.node.service.ServiceManager.java

public ServiceManager() {
    serviceServers = Maps.newConcurrentMap();
    serviceClients = Maps.newConcurrentMap();
}

From source file:com.github.hilcode.versionator.Model.java

public ImmutableCollection<Gav> createClosure(final ImmutableCollection<Gav> gavs) {
    final Map<GroupArtifact, Pom> groupArtifact2Pom = Maps.newConcurrentMap();
    for (final Pom pom : this.poms) {
        groupArtifact2Pom.put(pom.gav.groupArtifact, pom);
    }/*from ww  w.  jav a  2  s .  c o m*/
    final Map<GroupArtifact, Version> groupArtifact2Version = Maps.newConcurrentMap();
    for (final Gav gav : gavs) {
        if (groupArtifact2Version.containsKey(gav.groupArtifact)) {
            throw new IllegalStateException("Duplicate entry.");
        }
        groupArtifact2Version.put(gav.groupArtifact, gav.version);
    }
    final Set<Gav> gavs_ = Sets.newConcurrentHashSet(gavs);
    while (true) {
        boolean addedMoreGavs = false;
        final Map<Pom, Set<Pom>> map = Maps.newConcurrentMap();
        for (final Pom pom : this.poms) {
            if (pom.versionSource == POM) {
                if (!map.containsKey(pom)) {
                    map.put(pom, Sets.newConcurrentHashSet());
                }
                map.get(pom).add(pom);
            } else {
                final Pom pom_ = pom.findRoot();
                if (!map.containsKey(pom_)) {
                    map.put(pom_, Sets.newConcurrentHashSet());
                }
                map.get(pom_).add(pom);
            }
        }
        for (final Gav gav : gavs_) {
            if (groupArtifact2Pom.containsKey(gav.groupArtifact)) {
                final Pom pom = groupArtifact2Pom.get(gav.groupArtifact).findRoot();
                for (final Pom pom_ : map.get(pom)) {
                    if (!groupArtifact2Version.containsKey(pom_.gav.groupArtifact)) {
                        addedMoreGavs = addedMoreGavs
                                || gavs_.add(Gav.BUILDER.build(pom_.gav.groupArtifact, gav.version));
                    } else if (groupArtifact2Version.get(pom_.gav.groupArtifact) != gav.version) {
                        throw new IllegalStateException("Contradicting versions.");
                    }
                }
            }
        }
        if (!addedMoreGavs) {
            break;
        }
    }
    return ImmutableSet.copyOf(gavs_);
}

From source file:co.cask.tigon.analytics.Analytics.java

@Override
public void initialize(FlowletContext context) throws Exception {
    super.initialize(context);
    hashtagCounts = Maps.newConcurrentMap();
    LOG.info("Initialized Analysis flowlet.");
}

From source file:co.cask.cdap.data.stream.service.BasicStreamWriterSizeCollector.java

public BasicStreamWriterSizeCollector() {
    this.streamSizes = Maps.newConcurrentMap();
    this.truncationSubscriptions = Lists.newArrayList();
}

From source file:object.client.ext.ObjectClientConnectionPool.java

public ObjectClientConnectionPool(int poolSize, String remotehost, int port, ClassLoader classLoader) {
    this.poolSize = poolSize;
    this.remotehost = remotehost;
    this.port = port;
    this.classLoader = classLoader;
    pool = Maps.newConcurrentMap();

}

From source file:gobblin.util.PortUtils.java

@VisibleForTesting
PortUtils(PortLocator locator) {
    this.portLocator = locator;
    this.assignedPorts = Maps.newConcurrentMap();
}

From source file:org.ros.internal.message.MessageContext.java

public MessageContext(MessageDeclaration messageDeclaration) {
    this.messageDeclaration = messageDeclaration;
    this.fields = Maps.newConcurrentMap();
    this.orderedFields = Lists.newArrayList();
}

From source file:com.comphenix.protocol.utility.CachedPackage.java

/**
 * Construct a new cached package.//from  ww w.  j  av  a 2s .c o  m
 * @param packageName - the name of the current package.
 * @param source - the class source.
 */
public CachedPackage(String packageName, ClassSource source) {
    this.packageName = packageName;
    this.cache = Maps.newConcurrentMap();
    this.source = source;
}