From c12e1e44b353f2979247838ac536b3e02ff23db3 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Thu, 12 Aug 2010 20:59:47 +0000 Subject: [PATCH] Multimap is pretty rad git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6129 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/InvocationManager.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/java/com/threerings/presents/server/InvocationManager.java b/src/java/com/threerings/presents/server/InvocationManager.java index 6ca7e907f..38c8d2a8d 100644 --- a/src/java/com/threerings/presents/server/InvocationManager.java +++ b/src/java/com/threerings/presents/server/InvocationManager.java @@ -24,8 +24,9 @@ package com.threerings.presents.server; import java.util.List; import java.util.Map; +import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -142,11 +143,7 @@ public class InvocationManager // if it's a bootstrap service, slap it in the list if (group != null) { - List list = _bootlists.get(group); - if (list == null) { - _bootlists.put(group, list = Lists.newArrayList()); - } - list.add(marsh); + _bootlists.put(group, marsh); } _recentRegServices.put(Integer.valueOf(invCode), marsh.getClass().getName()); @@ -181,10 +178,7 @@ public class InvocationManager { List services = Lists.newArrayList(); for (String group : bootGroups) { - List list = _bootlists.get(group); - if (list != null) { - services.addAll(list); - } + services.addAll(_bootlists.get(group)); } return services; } @@ -309,7 +303,7 @@ public class InvocationManager protected IntMap> _dispatchers = IntMaps.newHashIntMap(); /** Maps bootstrap group to lists of services to be provided to clients at boot time. */ - protected Map> _bootlists = Maps.newHashMap(); + protected Multimap _bootlists = ArrayListMultimap.create(); /** Tracks recently registered services so that we can complain informatively if a request * comes in on a service we don't know about. */