From 73bcb0faaff40ada81db9fd6b5cdedcee4ed9122 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 11 Feb 2007 01:21:20 +0000 Subject: [PATCH] Let's put that code in the InvocationManager because we're going to need it elsewhere when we go fix the standalone servers. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4553 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/InvocationManager.java | 34 ++++++++++++++----- .../presents/server/PresentsClient.java | 9 +---- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/java/com/threerings/presents/server/InvocationManager.java b/src/java/com/threerings/presents/server/InvocationManager.java index 5efeccd2a..1cd0cdd82 100644 --- a/src/java/com/threerings/presents/server/InvocationManager.java +++ b/src/java/com/threerings/presents/server/InvocationManager.java @@ -21,6 +21,8 @@ package com.threerings.presents.server; +import java.util.HashMap; + import com.samskivert.util.HashIntMap; import com.samskivert.util.LRUHashMap; import com.samskivert.util.StringUtil; @@ -40,8 +42,6 @@ import com.threerings.presents.dobj.InvocationRequestEvent; import com.threerings.presents.dobj.ObjectAccessException; import com.threerings.presents.dobj.RootDObjectManager; -import java.util.HashMap; - /** * The invocation services provide client to server invocations (service requests) and server to * client invocations (responses and notifications). Via this mechanism, the client can make @@ -62,11 +62,6 @@ import java.util.HashMap; public class InvocationManager implements EventListener { - /** A mapping from bootstrap group to lists of services that are to be provided to clients at - * boot time. Don't mess with these lists! */ - public HashMap> bootlists = - new HashMap>(); - /** * Constructs an invocation manager which will use the supplied distributed object manager to * operate its invocation services. Generally only one invocation manager should be operational @@ -127,9 +122,9 @@ public class InvocationManager // if it's a bootstrap service, slap it in the list if (group != null) { - StreamableArrayList list = bootlists.get(group); + StreamableArrayList list = _bootlists.get(group); if (list == null) { - bootlists.put(group, list = new StreamableArrayList()); + _bootlists.put(group, list = new StreamableArrayList()); } list.add(marsh); } @@ -160,6 +155,22 @@ public class InvocationManager } } + /** + * Constructs a list of all bootstrap services registered in any of the supplied groups. + */ + public StreamableArrayList getBootstrapServices (String[] bootGroups) + { + StreamableArrayList services = + new StreamableArrayList(); + for (String group : bootGroups) { + StreamableArrayList list = _bootlists.get(group); + if (list != null) { + services.addAll(list); + } + } + return services; + } + /** * Get the class that is being used to dispatch the specified * invocation code, for informational purposes. @@ -295,6 +306,11 @@ public class InvocationManager protected HashIntMap _dispatchers = new HashIntMap(); + /** A mapping from bootstrap group to lists of services that are to be provided to clients at + * boot time. */ + protected HashMap> _bootlists = + new HashMap>(); + /** The text that is appended to the procedure name when automatically generating a failure * response. */ protected static final String FAILED_SUFFIX = "Failed"; diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java index bc9b09c07..37b1dd653 100644 --- a/src/java/com/threerings/presents/server/PresentsClient.java +++ b/src/java/com/threerings/presents/server/PresentsClient.java @@ -650,14 +650,7 @@ public class PresentsClient data.clientOid = _clobj.getOid(); // fill in the list of bootstrap services - data.services = new StreamableArrayList(); - for (String group : _areq.getBootGroups()) { - StreamableArrayList list = - PresentsServer.invmgr.bootlists.get(group); - if (list != null) { - data.services.addAll(list); - } - } + data.services = PresentsServer.invmgr.getBootstrapServices(_areq.getBootGroups()); } /**