Example usage for com.google.common.collect Multimaps synchronizedSetMultimap

List of usage examples for com.google.common.collect Multimaps synchronizedSetMultimap

Introduction

In this page you can find the example usage for com.google.common.collect Multimaps synchronizedSetMultimap.

Prototype

public static <K, V> SetMultimap<K, V> synchronizedSetMultimap(SetMultimap<K, V> multimap) 

Source Link

Document

Returns a synchronized (thread-safe) SetMultimap backed by the specified multimap.

Usage

From source file:org.restcomm.media.control.mgcp.call.MgcpCall.java

public MgcpCall(int callId) {
    this.callId = callId;
    this.entries = Multimaps.synchronizedSetMultimap(HashMultimap.<String, Integer>create(3, 3));
}

From source file:de.cosmocode.palava.core.DefaultRegistry.java

public DefaultRegistry() {
    final SetMultimap<Key<? extends Object>, Object> multimap = LinkedHashMultimap.create();
    this.mapping = Multimaps.synchronizedSetMultimap(multimap);
}

From source file:com.necla.simba.server.gateway.subscription.SubscriptionManager.java

public SubscriptionManager(BackendConnector client) {
    this.backend = client;
    tableSchemas = new ConcurrentHashMap<String, List<Column>>();
    tableVersions = new ConcurrentHashMap<String, Integer>();
    subscribers = Multimaps.synchronizedSetMultimap(HashMultimap.<String, ClientState>create());
}

From source file:com.github.rinde.rinsim.event.EventDispatcher.java

/**
 * Creates a new {@link EventDispatcher} instance which is capable of
 * dispatching any {@link Event} with a <code>type</code> attribute that is
 * one of <code>eventTypes</code>.
 * @param supportedEventTypes The types of events this EventDispatcher
 *          supports.//from w  ww .ja  va 2  s . com
 */
public EventDispatcher(Set<Enum<?>> supportedEventTypes) {
    checkArgument(!supportedEventTypes.isEmpty(), "At least one event type must be supported.");
    listeners = Multimaps.synchronizedSetMultimap(LinkedHashMultimap.<Enum<?>, Listener>create());
    supportedTypes = ImmutableSet.copyOf(supportedEventTypes);
    publicAPI = new PublicEventAPI(this);
    dispatching = new AtomicInteger(0);
    toRemove = LinkedHashMultimap.create();
    toAdd = LinkedHashMultimap.create();
}

From source file:com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModelImpl.java

CollisionGraphRoadModelImpl(ListenableGraph<?> g, double pMinConnLength,
        RoadModelBuilders.CollisionGraphRMB builder) {
    super(g, builder);
    vehicleLength = unitConversion.toInDist(builder.getVehicleLength());
    minDistance = unitConversion.toInDist(builder.getMinDistance());
    minConnLength = unitConversion.toInDist(pMinConnLength);
    occupiedNodes = Multimaps.synchronizedSetMultimap(CategoryMap.<MovingRoadUser, Point>create());
    getGraph().getEventAPI().addListener(new ModificationChecker(minConnLength),
            ListenableGraph.EventTypes.ADD_CONNECTION, ListenableGraph.EventTypes.CHANGE_CONNECTION_DATA);
}

From source file:org.lightjason.agentspeak.action.buildin.collection.multimap.CCreate.java

@Override
public final IFuzzyValue<Boolean> execute(final IContext p_context, final boolean p_parallel,
        final List<ITerm> p_argument, final List<ITerm> p_return, final List<ITerm> p_annotation) {
    final List<ITerm> l_arguments = CCommon.flatcollection(p_argument).collect(Collectors.toList());
    if ((l_arguments.size() > 0) && (l_arguments.size() % 2 == 1))
        return CFuzzyValue.from(false);

    final HashMultimap<Object, Object> l_map = HashMultimap.create();
    StreamUtils.windowed(l_arguments.stream(), 2).forEach(i -> l_map.put(i.get(0).raw(), i.get(1).raw()));
    p_return.add(CRawTerm.from(p_parallel ? Multimaps.synchronizedSetMultimap(l_map) : l_map));

    return CFuzzyValue.from(true);
}

From source file:org.apache.tez.dag.app.dag.StateChangeNotifier.java

public StateChangeNotifier(DAG dag) {
    this.dag = dag;
    this.vertexListeners = Multimaps
            .synchronizedSetMultimap(HashMultimap.<TezVertexID, ListenerContainer>create());
    this.lastKnowStatesMap = LinkedListMultimap.create();
    startThread();//from w  w w . j  a  va  2s  .  c  o  m
}

From source file:org.lightjason.agentspeak.action.builtin.collection.multimap.CCreate.java

@Nonnull
@Override/*from  ww w  . j  av a  2  s . c o  m*/
public final IFuzzyValue<Boolean> execute(final boolean p_parallel, @Nonnull final IContext p_context,
        @Nonnull final List<ITerm> p_argument, @Nonnull final List<ITerm> p_return) {
    final List<ITerm> l_arguments = CCommon.flatten(p_argument).collect(Collectors.toList());
    if ((l_arguments.size() > 0) && (l_arguments.size() % 2 == 1))
        return CFuzzyValue.from(false);

    final HashMultimap<Object, Object> l_map = HashMultimap.create();
    StreamUtils.windowed(l_arguments.stream(), 2).forEach(i -> l_map.put(i.get(0).raw(), i.get(1).raw()));
    p_return.add(CRawTerm.from(p_parallel ? Multimaps.synchronizedSetMultimap(l_map) : l_map));

    return CFuzzyValue.from(true);
}

From source file:com.android.build.gradle.shrinker.JavaSerializationShrinkerGraph.java

private JavaSerializationShrinkerGraph(File stateDir) {
    mStateDir = checkNotNull(stateDir);/*from   w  ww .  j a va2  s  .c o  m*/
    mShrinkCounters = new Counters(Maps.<String, DependencyType>newConcurrentMap(),
            ImmutableMap.<String, Counter>of());
    mMultidexCounters = new Counters(Maps.<String, DependencyType>newConcurrentMap(),
            ImmutableMap.<String, Counter>of());
    mMembers = Multimaps.synchronizedSetMultimap(HashMultimap.<String, String>create());
    mAnnotations = Multimaps.synchronizedSetMultimap(HashMultimap.<String, String>create());
    mClasses = Maps.newConcurrentMap();
    mModifiers = Maps.newConcurrentMap();
    mDependencies = Multimaps.synchronizedSetMultimap(HashMultimap.<String, Dependency<String>>create());
}

From source file:org.cloudifysource.cosmo.statecache.StateCache.java

public StateCache() {
    this.cache = TrieMap.empty();
    this.lockProvider = new NamedLockProvider();
    this.executorService = Executors.newSingleThreadExecutor();
    this.listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<String, StateCacheListenerHolder>create());
}