List of usage examples for com.google.common.collect Multimaps synchronizedMultimap
public static <K, V> Multimap<K, V> synchronizedMultimap(Multimap<K, V> multimap)
From source file:org.apache.mailbox.tools.indexer.registrations.MailboxRegistration.java
public MailboxRegistration(MailboxPath mailboxPath) { this.impactingMessageEvents = Multimaps .synchronizedMultimap(ArrayListMultimap.<MessageUid, ImpactingMessageEvent>create()); this.mailboxPath = mailboxPath; }
From source file:org.jfrog.teamcity.server.trigger.ArtifactoryBuildTriggerService.java
public ArtifactoryBuildTriggerService(@NotNull final PluginDescriptor descriptor, @NotNull final WebControllerManager wcm, @NotNull final DeployableArtifactoryServers deployableServers) { this.deployableServers = deployableServers; this.watchedItems = HashMultimap.create(); this.watchedItems = Multimaps.synchronizedMultimap(watchedItems); actualUrl = descriptor.getPluginResourcesPath("editArtifactoryTrigger.html"); final String actualJsp = descriptor.getPluginResourcesPath("editArtifactoryTrigger.jsp"); wcm.registerController(actualUrl,/*from ww w .ja v a2s .c om*/ new EditArtifactoryTriggerController(actualUrl, actualJsp, deployableServers)); }
From source file:com.dragovorn.dragonbot.api.bot.scheduler.BotScheduler.java
public BotScheduler() { this.lock = new Object(); this.taskCounter = new AtomicInteger(); this.unsafe = BotPlugin::getExecutorService; this.tasks = TCollections.synchronizedMap(new TIntObjectHashMap<BotTask>()); this.tasksByPlugin = Multimaps.synchronizedMultimap(HashMultimap.<BotPlugin, BotTask>create()); }
From source file:org.n52.movingcode.runtime.coderepository.PackageInventory.java
/** * No argument constructor.// w ww.ja va 2 s . c o m */ PackageInventory() { packagesByIdMap = new ConcurrentHashMap<PID, MovingCodePackage>(); // multimap for packageName -> packageId LUT Multimap<String, MovingCodePackage> delegate1 = ArrayListMultimap.create(); packagesByNameMap = Multimaps.synchronizedMultimap(delegate1); // multimap for functionId -> packageId LUT Multimap<String, MovingCodePackage> delegate2 = ArrayListMultimap.create(); packagesByFunctionIdMap = Multimaps.synchronizedMultimap(delegate2); }
From source file:it.units.malelab.ege.distributed.worker.Worker.java
public Worker(String keyPhrase, InetAddress masterAddress, int masterPort, int nThreads, String logDirectoryName) { this.keyPhrase = keyPhrase; this.masterAddress = masterAddress; this.masterPort = masterPort; this.maxThreads = nThreads; comExecutor = Executors.newSingleThreadScheduledExecutor(); taskExecutor = Executors.newFixedThreadPool(nThreads); runExecutor = Executors.newCachedThreadPool(); currentJobsData = (Multimap) Multimaps.synchronizedMultimap(ArrayListMultimap.create()); currentJobs = Collections.synchronizedSet(new HashSet<Job>()); completedJobsResults = Collections.synchronizedMap(new HashMap<Job, List<Node>>()); stats = (Multimap) Multimaps.synchronizedMultimap(ArrayListMultimap.create()); name = ManagementFactory.getRuntimeMXBean().getName(); interval = MASTER_INTERVAL;// w w w . j av a 2s . c o m printStreamFactory = new PrintStreamFactory(logDirectoryName); }
From source file:org.apache.james.jmap.memory.vacation.MemoryNotificationRegistry.java
@Inject public MemoryNotificationRegistry(ZonedDateTimeProvider zonedDateTimeProvider) { this.zonedDateTimeProvider = zonedDateTimeProvider; this.registrations = Multimaps.synchronizedMultimap(HashMultimap.create()); }
From source file:co.cask.cdap.notifications.service.AbstractNotificationService.java
protected AbstractNotificationService(DatasetFramework dsFramework, TransactionSystemClient transactionSystemClient, NotificationFeedManager feedManager) { this.dsFramework = dsFramework; this.transactionSystemClient = transactionSystemClient; this.feedManager = feedManager; this.subscribers = Multimaps .synchronizedMultimap(HashMultimap.<Id.NotificationFeed, NotificationCaller<?>>create()); }
From source file:org.openflexo.fib.view.widget.browser.FIBBrowserModel.java
/** * Stores controls: key is the JButton and value the PropertyListActionListener *//*from w w w .ja v a 2s . c o m*/ // private Hashtable<JButton,PropertyListActionListener> _controls; public FIBBrowserModel(FIBBrowser fibBrowser, FIBBrowserWidget widget, FIBController controller) { super(null); contents = Multimaps.synchronizedMultimap(ArrayListMultimap.<Object, BrowserCell>create()); _fibBrowser = fibBrowser; // _widget = widget; _elementTypes = new Hashtable<FIBBrowserElement, FIBBrowserElementType>(); for (FIBBrowserElement browserElement : fibBrowser.getElements()) { addToElementTypes(browserElement, buildBrowserElementType(browserElement, controller)); } // }
From source file:org.ros.node.DefaultNodeMainExecutor.java
/** * @param nodeFactory/* ww w . java 2s.c om*/ * {@link NodeFactory} to use for node creation. * @param scheduledExecutorService * {@link NodeMain}s will be executed using this */ private DefaultNodeMainExecutor(NodeFactory nodeFactory, ScheduledExecutorService scheduledExecutorService) { this.nodeFactory = nodeFactory; this.scheduledExecutorService = scheduledExecutorService; connectedNodes = Multimaps.synchronizedMultimap(HashMultimap.<GraphName, ConnectedNode>create()); nodeMains = Maps.synchronizedBiMap(HashBiMap.<Node, NodeMain>create()); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { DefaultNodeMainExecutor.this.shutdown(); } })); }
From source file:com.onboard.service.websocket.impl.WebSocketServiceImpl.java
@Override public void broadcastOne(String user, String message) { Multimap<String, MessageInbound> syncMap = Multimaps.synchronizedMultimap(userPagesMap); Collection<MessageInbound> mis = syncMap.get(user); synchronized (syncMap) { if (mis != null) { Iterator<MessageInbound> it = mis.iterator(); while (it.hasNext()) { MessageInbound inbound = it.next(); try { sendToPage(inbound, message); } catch (IOException e) { // userPagesMap.remove(user, inbound); logger.info("The WebSocket connection has been closed: " + inbound.toString()); }/* w w w . j a va2 s. co m*/ } } } }