Initializing the invocation director reference on deserialization doesn't work

well in standalone mode.  We need a way to install a director on registration.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6413 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Andrzej Kapolka
2011-01-05 01:32:13 +00:00
parent 68aba0e92a
commit 0c28d31357
2 changed files with 19 additions and 3 deletions
@@ -214,10 +214,11 @@ public class InvocationMarshaller
* to operate in the wide world. This is called by the invocation manager when an invocation
* provider is registered and should not be called otherwise.
*/
public void init (int invOid, int invCode)
public void init (int invOid, int invCode, InvocationDirector invDir)
{
_invOid = invOid;
_invCode = invCode;
_invdir = invDir;
}
/**
@@ -42,6 +42,7 @@ import com.samskivert.util.StringUtil;
import com.threerings.io.Streamable;
import com.threerings.presents.client.InvocationDirector;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationCodes;
import com.threerings.presents.data.InvocationMarshaller;
@@ -93,6 +94,17 @@ 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.
*/
@@ -172,7 +184,7 @@ public class InvocationManager
T marsh;
try {
marsh = mclass.newInstance();
marsh.init(_invoid, invCode);
marsh.init(_invoid, invCode, _invdir);
} catch (IllegalAccessException ie) {
throw new RuntimeException(ie);
} catch (InstantiationException ie) {
@@ -272,7 +284,7 @@ public class InvocationManager
// create the marshaller and initialize it
T marsh = dispatcher.createMarshaller();
marsh.init(_invoid, invCode);
marsh.init(_invoid, invCode, _invdir);
// register the dispatcher
_dispatchers.put(invCode, dispatcher);
@@ -438,6 +450,9 @@ 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;
/** The distributed object manager we're working with. */
protected PresentsDObjectMgr _omgr;