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.github.lburgazzoli.quickfixj.core.FIXContext.java

/**
 * c-tor//from   ww  w  .  ja  v  a2  s.  c  o m
 *
 * @param id;
 */
public FIXContext(String id) {
    m_id = id;
    m_threadFactory = new NamedThreadFactory("QFJ_Timer");
    m_scheduler = Executors.newSingleThreadScheduledExecutor(m_threadFactory);
    m_sessions = Maps.newConcurrentMap();
}

From source file:com.twitter.hbc.core.endpoint.RawEndpoint.java

/**
 * @param uri        should be the full uri, including the starting "/" and the api version, and any query params.
 * @param postParams any http POST parameters (not encoded)
 *///from w ww  .  jav  a 2 s .  c  o m
public RawEndpoint(String uri, String httpMethod, Map<String, String> postParams) {
    this.uri = Preconditions.checkNotNull(uri);
    this.httpMethod = Preconditions.checkNotNull(httpMethod);
    Preconditions.checkArgument(HttpConstants.checkHttpMethod(httpMethod));
    Preconditions.checkNotNull(postParams);
    this.postParams = Maps.newConcurrentMap();
    this.queryParameters = Maps.newConcurrentMap();
    postParams.putAll(postParams);
}

From source file:org.codetrack.database.file.FileProject.java

/**
 * Constructor with FileProject.Builder instance
 *
 * @param builder instance/*from   w  w  w .  j ava  2s . c  o  m*/
 */
private FileProject(Builder builder) {
    itemsMap = Maps.newConcurrentMap();
    setDescription(builder.description);
    setId(builder.id);
    setName(builder.name);
    if (builder.database != null)
        builder.database.addProject(this);
}

From source file:com.netflix.metacat.main.manager.PluginManager.java

/**
 * Constructor.//from  w  w w  . jav a  2  s  .c  o  m
 * @param injector injector
 * @param connectorManager manager
 * @param typeRegistry registry
 */
@Inject
public PluginManager(final Injector injector, final ConnectorManager connectorManager,
        final TypeRegistry typeRegistry) {
    Preconditions.checkNotNull(injector, "injector is null");

    this.injector = injector;

    optionalConfig = Maps.newConcurrentMap();

    this.connectorManager = Preconditions.checkNotNull(connectorManager, "connectorManager is null");
    this.typeRegistry = Preconditions.checkNotNull(typeRegistry, "typeRegistry is null");
}

From source file:org.ros.rosjava_geometry.FrameTransformTree.java

public FrameTransformTree(NameResolver nameResolver) {
    Preconditions.checkNotNull(nameResolver);
    this.nameResolver = nameResolver;
    mutex = new Object();
    transforms = Maps.newConcurrentMap();
}

From source file:org.gradle.api.internal.artifacts.transform.ConsumerProvidedResolvedVariant.java

@Override
public Completion startVisit(BuildOperationQueue<RunnableBuildOperation> actions,
        AsyncArtifactListener listener) {
    Map<ComponentArtifactIdentifier, TransformArtifactOperation> artifactResults = Maps.newConcurrentMap();
    Map<File, TransformFileOperation> fileResults = Maps.newConcurrentMap();
    Completion result = delegate.startVisit(actions, new TransformingAsyncArtifactListener(transform, listener,
            actions, artifactResults, fileResults, transformListener));
    return new TransformCompletion(result, attributes, artifactResults, fileResults);
}

From source file:com.davidbracewell.reflection.BeanDescriptor.java

/**
 * Default Constructor that initializes the descriptor using class information
 *
 * @param clazz The class associated with this descriptor
 *//* ww  w  .  ja v a  2s .co  m*/
public BeanDescriptor(Class<?> clazz) {
    this.clazz = clazz;
    readMethods = Maps.newConcurrentMap();
    writeMethods = Maps.newConcurrentMap();
    try {
        BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
        PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();

        if (descriptors == null || descriptors.length == 0) {
            return;
        }

        for (PropertyDescriptor descriptor : descriptors) {
            String name = descriptor.getName();
            Method readMethod = descriptor.getReadMethod();
            Method writeMethod = descriptor.getWriteMethod();

            if (readMethod != null) {
                readMethods.put(name, readMethod);
            }
            if (writeMethod != null) {
                writeMethods.put(name, writeMethod);
            }
        }
    } catch (IntrospectionException e) {
        throw Throwables.propagate(e);
    }

}

From source file:com.turn.sorcerer.executor.TaskScheduler.java

public TaskScheduler(ExecutablePipeline pipeline, int jobId, int numOfThreads,
        Map<TaskType, Map<String, String>> taskArgMap, boolean adhoc, boolean overwriteTasks) {
    this.pipeline = pipeline;
    this.taskArgMap = taskArgMap;
    this.adhoc = adhoc;
    this.jobId = jobId;
    this.ignoreTaskComplete = overwriteTasks;

    if (numOfThreads > 0) {
        executionPool = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(numOfThreads));
    } else {/*w w  w  .j  a  v  a 2s  .  c  om*/
        executionPool = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
    }
    runningTasks = Maps.newConcurrentMap();

}

From source file:co.cask.tigon.sql.internal.HealthInspector.java

/**
 * Constructor for HealthInspector which ensures the liveness of the SQL Compiler processes.
 * If the class fails to detect a heartbeat from every registered process in the last two seconds then this class
 * invokes the {@link ProcessMonitor#notifyFailure(java.util.Set)} defined in the {@link ProcessMonitor} object.
 *
 * @param processMonitor The reference of the class that implements
 * {@link ProcessMonitor#notifyFailure(java.util.Set)}
 *//*  ww  w .j av a 2 s  .com*/
public HealthInspector(ProcessMonitor processMonitor) {
    serviceFailed = processMonitor;
    Map<String, Boolean> heartbeatMap = Maps.newConcurrentMap();
    Map<String, Boolean> modelMap = Maps.newConcurrentMap();
    heartbeatCounter = Sets.newSetFromMap(heartbeatMap);
    modelCounter = Sets.newSetFromMap(modelMap);
}

From source file:com.facebook.buck.event.listener.LoadBalancerEventsListener.java

public LoadBalancerEventsListener(CounterRegistry registry) {
    this.registry = registry;
    this.allServerCounters = Maps.newConcurrentMap();

    noHealthyServersCounter = registry.newIntegerCounter(COUNTER_CATEGORY, "no_healthy_servers_count",
            ImmutableMap.of());/*from ww w .  j  a  va2s  . co  m*/
}