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:com.dtstack.jlogstash.distributed.http.server.PostHandler.java

protected Map<String, Object> parseQuery(String query) throws IOException {
    Map<String, Object> parameters = Maps.newConcurrentMap();
    if (StringUtils.isNotBlank(query)) {
        parameters.putAll(objectMapper.readValue(query.getBytes(), Map.class));
    }/*from  w w w. j a  v a  2s . co  m*/
    return parameters;
}

From source file:org.gradoop.flink.model.impl.operators.grouping.functions.BuildVertexWithSuperVertexBC.java

/**
 * Creates the mapper/* ww w .j  a va 2  s . co m*/
 */
public BuildVertexWithSuperVertexBC() {
    this.reuseTuple = new VertexWithSuperVertex();
    this.cache = Maps.newConcurrentMap();
}

From source file:tajo.engine.planner.global.QueryUnit.java

public QueryUnit(QueryUnitId id) {
    this.id = id;
    scan = new ArrayList<ScanNode>();
    fetchMap = Maps.newHashMap();//  w w  w .  j  a  v  a  2 s .  c o  m
    fragMap = Maps.newHashMap();
    partitions = new ArrayList<Partition>();
    attemptMap = Maps.newConcurrentMap();
    lastAttemptId = -1;
}

From source file:org.apache.apex.engine.util.CascadeStorageAgent.java

public CascadeStorageAgent(StorageAgent parent, StorageAgent current) {
    this.parent = parent;
    this.current = current;
    oldOperatorToWindowIdsMap = Maps.newConcurrentMap();
}

From source file:org.apache.giraph.partition.SimplePartition.java

@Override
public void initialize(int partitionId, Progressable progressable) {
    super.initialize(partitionId, progressable);
    if (USE_OUT_OF_CORE_MESSAGES.get(getConf())) {
        vertexMap = new ConcurrentSkipListMap<I, Vertex<I, V, E, M>>();
    } else {//w  w w  .j a v  a2s .  c o  m
        vertexMap = Maps.newConcurrentMap();
    }
}

From source file:org.gradle.api.internal.artifacts.DefaultImmutableModuleIdentifierFactory.java

@Override
public ModuleVersionIdentifier moduleWithVersion(ModuleIdentifier mi, String version) {
    Map<String, ModuleVersionIdentifier> byVersion = idToVersions.get(mi);
    if (byVersion == null) {
        byVersion = idToVersions.get(mi);
        if (byVersion == null) {
            byVersion = Maps.newConcurrentMap();
            idToVersions.put(mi, byVersion);
        }//  www. j  a  v a 2  s .  c o m
    }
    ModuleVersionIdentifier identifier = byVersion.get(version);
    if (identifier == null) {
        identifier = DefaultModuleVersionIdentifier.newId(mi, version);
        byVersion.put(version, identifier);
    }
    return identifier;
}

From source file:com.chessix.vas.service.ClasService.java

/**
 * Auto wired constructor/*from   w  w w .  ja  v a2  s.  c om*/
 */
@Autowired
public ClasService(final ActorSystem system, final ISpeedStorage storage, final DBService dbService,
        final ActorRef journalActor) {
    super();
    this.system = system;
    this.storage = storage;
    this.dbService = dbService;
    this.journalActor = journalActor;
    this.clasManager = Maps.newConcurrentMap();
}

From source file:com.dtstack.jlogstash.classloader.JarClassLoader.java

private Map<String, URL[]> getClassLoadJarUrls() {
    Map<String, URL[]> result = Maps.newConcurrentMap();
    try {//from w w w . j av a2  s .  co  m
        logger.warn("userDir:{}", userDir);
        String input = String.format("%s/plugin/input", userDir);
        File finput = new File(input);
        if (!finput.exists()) {
            throw new LogstashException(String.format("%s direcotry not found", input));
        }

        String filter = String.format("%s/plugin/filter", userDir);
        File ffilter = new File(filter);
        if (!ffilter.exists()) {
            throw new LogstashException(String.format("%s direcotry not found", filter));
        }

        String output = String.format("%s/plugin/output", userDir);
        File foutput = new File(output);
        if (!foutput.exists()) {
            throw new LogstashException(String.format("%s direcotry not found", output));
        }
        Map<String, URL[]> inputs = getClassLoadJarUrls(finput);
        result.putAll(inputs);
        Map<String, URL[]> filters = getClassLoadJarUrls(ffilter);
        result.putAll(filters);
        Map<String, URL[]> outputs = getClassLoadJarUrls(foutput);
        result.putAll(outputs);
        logger.warn("getClassLoadJarUrls:{}", result);
    } catch (Exception e) {
        logger.error("getClassLoadJarUrls error:{}", ExceptionUtil.getErrorMessage(e));
    }
    return result;
}

From source file:com.kik.config.ice.source.AbstractDynamicConfigSource.java

protected AbstractDynamicConfigSource(Collection<ConfigDescriptor> configDescriptors) {
    if (configDescriptors == null) {
        configDescriptors = Collections.emptySet();
    }/* w  w  w  . j  a va  2 s.  c  o  m*/

    if (configDescriptors.isEmpty()) {
        log.warn(
                "No config descriptors found. If you don't have any configurations installed, this warning can be ignored.");
    }

    this.configDescriptors = configDescriptors.stream()
            .sorted(Comparator.comparing(desc -> desc.getConfigName())).collect(toImmutableList());

    this.lastEmittedValues = Maps.newConcurrentMap();

    // Initialize lastEmittedValues and subjectMap for each descriptor
    ImmutableMap.Builder mapBuilder = ImmutableMap.builder();
    for (ConfigDescriptor desc : configDescriptors) {
        BehaviorSubject<ConfigChangeEvent<String>> behaviorSubject = BehaviorSubject.create();
        behaviorSubject.onNext(new ConfigChangeEvent<>(desc.getConfigName(), Optional.empty()));
        mapBuilder.put(desc.getConfigName(), behaviorSubject.toSerialized());
        lastEmittedValues.put(desc.getConfigName(), Optional.empty());
    }
    subjectMap = mapBuilder.build();

    log.debug("Finished constructing Rx.Subjects for {} configuration keys", configDescriptors.size());
}

From source file:io.druid.common.config.ConfigManager.java

@Inject
public ConfigManager(MetadataStorageConnector dbConnector, Supplier<MetadataStorageTablesConfig> dbTables,
        Supplier<ConfigManagerConfig> config) {
    this.dbConnector = dbConnector;
    this.config = config;

    this.exec = ScheduledExecutors.fixed(1, "config-manager-%s");
    this.watchedConfigs = Maps.newConcurrentMap();

    this.configTable = dbTables.get().getConfigTable();
}