From f9ce9f69394aa39c147997d126a4572f2fcb9bcc Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Wed, 5 Jan 2011 02:03:25 +0000 Subject: [PATCH] On second thought, let's configure the standalone client reference via an optional injection. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6414 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/InvocationManager.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/threerings/presents/server/InvocationManager.java b/src/main/java/com/threerings/presents/server/InvocationManager.java index c6df43305..285d3048d 100644 --- a/src/main/java/com/threerings/presents/server/InvocationManager.java +++ b/src/main/java/com/threerings/presents/server/InvocationManager.java @@ -42,7 +42,7 @@ import com.samskivert.util.StringUtil; import com.threerings.io.Streamable; -import com.threerings.presents.client.InvocationDirector; +import com.threerings.presents.client.Client; import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.InvocationCodes; import com.threerings.presents.data.InvocationMarshaller; @@ -94,17 +94,6 @@ public class InvocationManager log.debug("Created invocation service object", "oid", _invoid); } - /** - * Sets the invocation director to install in created marshallers. This is used in standalone - * mode, where marshallers are not streamed (usually, the director reference is set on - * unstreaming). - */ - public void setInvocationDirector (InvocationDirector invdir) - { - // TODO: change references in existing marshallers? - _invdir = invdir; - } - /** * Returns the object id of the invocation services object. */ @@ -184,7 +173,8 @@ public class InvocationManager T marsh; try { marsh = mclass.newInstance(); - marsh.init(_invoid, invCode, _invdir); + marsh.init(_invoid, invCode, _standaloneClient == null ? + null : _standaloneClient.getInvocationDirector()); } catch (IllegalAccessException ie) { throw new RuntimeException(ie); } catch (InstantiationException ie) { @@ -284,7 +274,8 @@ public class InvocationManager // create the marshaller and initialize it T marsh = dispatcher.createMarshaller(); - marsh.init(_invoid, invCode, _invdir); + marsh.init(_invoid, invCode, _standaloneClient == null ? + null : _standaloneClient.getInvocationDirector()); // register the dispatcher _dispatchers.put(invCode, dispatcher); @@ -450,8 +441,8 @@ public class InvocationManager /** Used to generate monotonically increasing provider ids. */ protected int _invCode; - /** The invocation director reference to install in created marshallers (if any). */ - protected InvocationDirector _invdir; + /** A reference to the standalone client, if any. */ + @Inject(optional=true) protected Client _standaloneClient; /** The distributed object manager we're working with. */ protected PresentsDObjectMgr _omgr;