From fc7706c79dbc6467397ad5138e65ed77c0747415 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 2 Apr 2011 00:01:46 +0000 Subject: [PATCH] Get the transport specification out of the construction path, since it's not a streamed property of the event. It turns out to be cleaner to just set it in the places where we know that we want a specific transport anyway. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6581 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../admin/data/AdminMarshaller.java | 5 +---- .../crowd/chat/data/ChatMarshaller.java | 5 +---- .../crowd/data/LocationMarshaller.java | 5 +---- .../presents/client/InvocationDirector.java | 4 ++-- .../presents/data/InvocationMarshaller.java | 20 ++++++++++++++----- .../presents/data/TimeBaseMarshaller.java | 5 +---- .../presents/dobj/AttributeChangedEvent.java | 8 ++------ .../presents/dobj/CompoundEvent.java | 7 ++++--- .../com/threerings/presents/dobj/DEvent.java | 6 +++--- .../com/threerings/presents/dobj/DObject.java | 10 +++++----- .../presents/dobj/ElementUpdatedEvent.java | 8 ++------ .../presents/dobj/EntryAddedEvent.java | 4 +--- .../threerings/presents/dobj/EntryEvent.java | 7 ++----- .../presents/dobj/EntryRemovedEvent.java | 4 +--- .../presents/dobj/EntryUpdatedEvent.java | 7 ++----- .../dobj/InvocationNotificationEvent.java | 8 ++------ .../presents/dobj/InvocationRequestEvent.java | 8 ++------ .../dobj/InvocationResponseEvent.java | 15 +++++++++----- .../presents/dobj/MessageEvent.java | 7 ++----- .../threerings/presents/dobj/NamedEvent.java | 7 ++----- .../presents/dobj/ObjectAddedEvent.java | 4 +--- .../presents/dobj/ObjectDestroyedEvent.java | 4 +--- .../presents/dobj/ObjectRemovedEvent.java | 4 +--- .../presents/dobj/ReleaseLockEvent.java | 4 +--- .../presents/dobj/ServerMessageEvent.java | 4 +--- .../presents/server/InvocationSender.java | 6 +++--- .../presents/server/PresentsDObjectMgr.java | 3 +-- .../threerings/presents/tools/marshaller.tmpl | 5 +---- .../presents/data/TestMarshaller.java | 10 ++-------- 29 files changed, 73 insertions(+), 121 deletions(-) diff --git a/src/main/java/com/threerings/admin/data/AdminMarshaller.java b/src/main/java/com/threerings/admin/data/AdminMarshaller.java index 014137318..854125093 100644 --- a/src/main/java/com/threerings/admin/data/AdminMarshaller.java +++ b/src/main/java/com/threerings/admin/data/AdminMarshaller.java @@ -52,10 +52,7 @@ public class AdminMarshaller extends InvocationMarshaller // from interface ConfigInfoMarshaller public void gotConfigInfo (String[] arg1, int[] arg2) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, GOT_CONFIG_INFO, - new Object[] { arg1, arg2 }, transport)); + sendResponse(GOT_CONFIG_INFO, new Object[] { arg1, arg2 }); } @Override // from InvocationMarshaller diff --git a/src/main/java/com/threerings/crowd/chat/data/ChatMarshaller.java b/src/main/java/com/threerings/crowd/chat/data/ChatMarshaller.java index d4c4f6d3e..28cee7ed4 100644 --- a/src/main/java/com/threerings/crowd/chat/data/ChatMarshaller.java +++ b/src/main/java/com/threerings/crowd/chat/data/ChatMarshaller.java @@ -54,10 +54,7 @@ public class ChatMarshaller extends InvocationMarshaller // from interface TellMarshaller public void tellSucceeded (long arg1, String arg2) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, TELL_SUCCEEDED, - new Object[] { Long.valueOf(arg1), arg2 }, transport)); + sendResponse(TELL_SUCCEEDED, new Object[] { Long.valueOf(arg1), arg2 }); } @Override // from InvocationMarshaller diff --git a/src/main/java/com/threerings/crowd/data/LocationMarshaller.java b/src/main/java/com/threerings/crowd/data/LocationMarshaller.java index 850f54eae..381a58b8d 100644 --- a/src/main/java/com/threerings/crowd/data/LocationMarshaller.java +++ b/src/main/java/com/threerings/crowd/data/LocationMarshaller.java @@ -52,10 +52,7 @@ public class LocationMarshaller extends InvocationMarshaller // from interface MoveMarshaller public void moveSucceeded (PlaceConfig arg1) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, MOVE_SUCCEEDED, - new Object[] { arg1 }, transport)); + sendResponse(MOVE_SUCCEEDED, new Object[] { arg1 }); } @Override // from InvocationMarshaller diff --git a/src/main/java/com/threerings/presents/client/InvocationDirector.java b/src/main/java/com/threerings/presents/client/InvocationDirector.java index a35baa834..b1ef742f6 100644 --- a/src/main/java/com/threerings/presents/client/InvocationDirector.java +++ b/src/main/java/com/threerings/presents/client/InvocationDirector.java @@ -227,8 +227,8 @@ public class InvocationDirector } // create an invocation request event - InvocationRequestEvent event = - new InvocationRequestEvent(invOid, invCode, methodId, args, transport); + InvocationRequestEvent event = new InvocationRequestEvent(invOid, invCode, methodId, args); + event.setTransport(transport); // because invocation directors are used on the server, we set the source oid here so that // invocation requests are properly attributed to the right client object when created by diff --git a/src/main/java/com/threerings/presents/data/InvocationMarshaller.java b/src/main/java/com/threerings/presents/data/InvocationMarshaller.java index 3614411cd..3cb1184ea 100644 --- a/src/main/java/com/threerings/presents/data/InvocationMarshaller.java +++ b/src/main/java/com/threerings/presents/data/InvocationMarshaller.java @@ -95,9 +95,7 @@ public class InvocationMarshaller // documentation inherited from interface public void requestFailed (String cause) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, REQUEST_FAILED_RSPID, new Object[] { cause }, transport)); + sendResponse(REQUEST_FAILED_RSPID, cause); } /** @@ -134,6 +132,16 @@ public class InvocationMarshaller } } + /** + * Handles sending a response to our requester. + */ + protected void sendResponse (int methodId, Object... args) + { + _invId = null; + omgr.postEvent(new InvocationResponseEvent(callerOid, requestId, methodId, args). + setTransport(transport)); + } + /** * Performs type casts in a way that works for parameterized types as well as simple types. */ @@ -161,7 +169,8 @@ public class InvocationMarshaller { _invId = null; omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, REQUEST_PROCESSED, null, transport)); + callerOid, requestId, REQUEST_PROCESSED, null). + setTransport(transport)); } @Override @@ -192,7 +201,8 @@ public class InvocationMarshaller { _invId = null; omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, REQUEST_PROCESSED, new Object[] { result }, transport)); + callerOid, requestId, REQUEST_PROCESSED, new Object[] { result }). + setTransport(transport)); } @Override diff --git a/src/main/java/com/threerings/presents/data/TimeBaseMarshaller.java b/src/main/java/com/threerings/presents/data/TimeBaseMarshaller.java index af36f7b62..9a9caff0f 100644 --- a/src/main/java/com/threerings/presents/data/TimeBaseMarshaller.java +++ b/src/main/java/com/threerings/presents/data/TimeBaseMarshaller.java @@ -51,10 +51,7 @@ public class TimeBaseMarshaller extends InvocationMarshaller // from interface GotTimeBaseMarshaller public void gotTimeOid (int arg1) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, GOT_TIME_OID, - new Object[] { Integer.valueOf(arg1) }, transport)); + sendResponse(GOT_TIME_OID, new Object[] { Integer.valueOf(arg1) }); } @Override // from InvocationMarshaller diff --git a/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java b/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java index 52448b550..c34c6fcc5 100644 --- a/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/AttributeChangedEvent.java @@ -25,8 +25,6 @@ import java.lang.reflect.Array; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * An attribute changed event is dispatched when a single attribute of a distributed object has * changed. It can also be constructed to request an attribute change on an object and posted to @@ -151,12 +149,10 @@ public class AttributeChangedEvent extends NamedEvent * @param name the name of the attribute (data member) that has changed. * @param value the new value of the attribute (in the case of primitive types, the * reflection-defined object-alternative is used). - * @param transport a hint as to the type of transport desired for the event. */ - protected AttributeChangedEvent ( - int targetOid, String name, Object value, Object oldValue, Transport transport) + protected AttributeChangedEvent (int targetOid, String name, Object value, Object oldValue) { - super(targetOid, name, transport); + super(targetOid, name); _value = value; _oldValue = oldValue; } diff --git a/src/main/java/com/threerings/presents/dobj/CompoundEvent.java b/src/main/java/com/threerings/presents/dobj/CompoundEvent.java index b722f675b..541eb0c32 100644 --- a/src/main/java/com/threerings/presents/dobj/CompoundEvent.java +++ b/src/main/java/com/threerings/presents/dobj/CompoundEvent.java @@ -40,7 +40,7 @@ public class CompoundEvent extends DEvent */ public CompoundEvent (DObject target, DObjectManager omgr) { - super(target.getOid(), Transport.DEFAULT); + super(target.getOid()); // sanity check if (omgr == null) { @@ -56,7 +56,7 @@ public class CompoundEvent extends DEvent /** Used when unserializing. */ public CompoundEvent () { - super(0, Transport.DEFAULT); + super(0); } /** @@ -143,12 +143,13 @@ public class CompoundEvent extends DEvent } @Override - public void setTransport (Transport transport) + public DEvent setTransport (Transport transport) { super.setTransport(transport); for (int ii = 0, nn = _events.size(); ii < nn; ii++) { _events.get(ii).setTransport(transport); } + return this; } @Override diff --git a/src/main/java/com/threerings/presents/dobj/DEvent.java b/src/main/java/com/threerings/presents/dobj/DEvent.java index ab8112bbc..22862b2e0 100644 --- a/src/main/java/com/threerings/presents/dobj/DEvent.java +++ b/src/main/java/com/threerings/presents/dobj/DEvent.java @@ -41,10 +41,9 @@ public abstract class DEvent implements Streamable * * @param transport a hint as to the type of transport desired for the event. */ - public DEvent (int targetOid, Transport transport) + public DEvent (int targetOid) { _toid = targetOid; - _transport = transport; } /** @@ -124,9 +123,10 @@ public abstract class DEvent implements Streamable * mode of transport over which the event was received. When an event is sent over the * network, these act as a hint as to the type of transport desired. */ - public void setTransport (Transport transport) + public DEvent setTransport (Transport transport) { _transport = transport; + return this; } /** diff --git a/src/main/java/com/threerings/presents/dobj/DObject.java b/src/main/java/com/threerings/presents/dobj/DObject.java index efcfb8fac..49b910658 100644 --- a/src/main/java/com/threerings/presents/dobj/DObject.java +++ b/src/main/java/com/threerings/presents/dobj/DObject.java @@ -558,7 +558,7 @@ public class DObject */ public void postMessage (Transport transport, String name, Object... args) { - postEvent(new MessageEvent(_oid, name, args, transport)); + postEvent(new MessageEvent(_oid, name, args).setTransport(transport)); } /** @@ -871,7 +871,7 @@ public class DObject String name, Object value, Object oldValue, Transport transport) { // dispatch an attribute changed event - postEvent(new AttributeChangedEvent(_oid, name, value, oldValue, transport)); + postEvent(new AttributeChangedEvent(_oid, name, value, oldValue).setTransport(transport)); } /** @@ -889,8 +889,8 @@ public class DObject String name, int index, Object value, Object oldValue, Transport transport) { // dispatch an attribute changed event - postEvent(new ElementUpdatedEvent( - _oid, name, value, oldValue, index, transport)); + postEvent(new ElementUpdatedEvent(_oid, name, value, oldValue, index). + setTransport(transport)); } /** @@ -989,7 +989,7 @@ public class DObject } } // dispatch an entry updated event - postEvent(new EntryUpdatedEvent(_oid, name, entry, oldEntry, transport)); + postEvent(new EntryUpdatedEvent(_oid, name, entry, oldEntry).setTransport(transport)); } protected boolean isAuthoritative () diff --git a/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java b/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java index f6ad25986..ba91ddb4b 100644 --- a/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ElementUpdatedEvent.java @@ -26,8 +26,6 @@ import java.lang.reflect.Field; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * An element updated event is dispatched when an element of an array field in a distributed object * is updated. It can also be constructed to request the update of an entry and posted to the @@ -48,12 +46,10 @@ public class ElementUpdatedEvent extends NamedEvent * @param ovalue the previous value of the element (in the case of primitive types, the * reflection-defined object-alternative is used). * @param index the index in the array of the updated element. - * @param transport a hint as to the type of transport desired for the event. */ - public ElementUpdatedEvent ( - int targetOid, String name, Object value, Object ovalue, int index, Transport transport) + public ElementUpdatedEvent (int targetOid, String name, Object value, Object ovalue, int index) { - super(targetOid, name, transport); + super(targetOid, name); _value = value; _oldValue = ovalue; _index = index; diff --git a/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java index c94c6d647..ec812c775 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryAddedEvent.java @@ -23,8 +23,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * An entry added event is dispatched when an entry is added to a {@link DSet} attribute of a * distributed entry. It can also be constructed to request the addition of an entry to a set and @@ -47,7 +45,7 @@ public class EntryAddedEvent extends EntryEvent */ public EntryAddedEvent (int targetOid, String name, T entry) { - super(targetOid, name, Transport.DEFAULT); + super(targetOid, name); _entry = entry; } diff --git a/src/main/java/com/threerings/presents/dobj/EntryEvent.java b/src/main/java/com/threerings/presents/dobj/EntryEvent.java index b5b57f56c..149ba26ae 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * A common parent class for DSet entry events. */ @@ -33,11 +31,10 @@ public abstract class EntryEvent extends NamedEvent * * @param targetOid the object id of the object in question. * @param name the name associated with this event. - * @param transport a hint as to the type of transport desired for the event. */ - public EntryEvent (int targetOid, String name, Transport transport) + public EntryEvent (int targetOid, String name) { - super(targetOid, name, transport); + super(targetOid, name); } /** diff --git a/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java index 0d93c4952..261d8588c 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryRemovedEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - import static com.threerings.presents.Log.log; /** @@ -48,7 +46,7 @@ public class EntryRemovedEvent extends EntryEvent */ public EntryRemovedEvent (int targetOid, String name, Comparable key, T oldEntry) { - super(targetOid, name, Transport.DEFAULT); + super(targetOid, name); _key = key; _oldEntry = oldEntry; } diff --git a/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java b/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java index 89115d3e8..a92c49aad 100644 --- a/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/EntryUpdatedEvent.java @@ -23,8 +23,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - import static com.threerings.presents.Log.log; /** @@ -46,11 +44,10 @@ public class EntryUpdatedEvent extends EntryEvent * @param name the name of the attribute in which to update the specified entry. * @param entry the entry to update. * @param oldEntry the previous value of the entry. - * @param transport a hint as to the type of transport desired for the event. */ - public EntryUpdatedEvent (int targetOid, String name, T entry, T oldEntry, Transport transport) + public EntryUpdatedEvent (int targetOid, String name, T entry, T oldEntry) { - super(targetOid, name, transport); + super(targetOid, name); _entry = entry; _oldEntry = oldEntry; } diff --git a/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java index f44ffddaa..c19698545 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationNotificationEvent.java @@ -23,8 +23,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * Used to dispatch an invocation notification from the server to a client. * @@ -41,12 +39,10 @@ public class InvocationNotificationEvent extends DEvent * @param methodId the id of the method to be invoked. * @param args the arguments for the method. This array should contain only values of valid * distributed object types. - * @param transport a hint as to the type of transport desired for the event. */ - public InvocationNotificationEvent ( - int targetOid, short receiverId, int methodId, Object[] args, Transport transport) + public InvocationNotificationEvent (int targetOid, short receiverId, int methodId, Object[] args) { - super(targetOid, transport); + super(targetOid); _receiverId = receiverId; _methodId = (byte)methodId; _args = args; diff --git a/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java index 87a98f531..f77859654 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationRequestEvent.java @@ -23,8 +23,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * Used to dispatch an invocation request from the client to the server. * @@ -41,12 +39,10 @@ public class InvocationRequestEvent extends DEvent * @param methodId the id of the method to be invoked. * @param args the arguments for the method. This array should contain only values of valid * distributed object types. - * @param transport a hint as to the type of transport desired for the event. */ - public InvocationRequestEvent ( - int targetOid, int invCode, int methodId, Object[] args, Transport transport) + public InvocationRequestEvent (int targetOid, int invCode, int methodId, Object[] args) { - super(targetOid, transport); + super(targetOid); _invCode = invCode; _methodId = (byte)methodId; _args = args; diff --git a/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java b/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java index 96ee67b32..b8c420e05 100644 --- a/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java +++ b/src/main/java/com/threerings/presents/dobj/InvocationResponseEvent.java @@ -22,7 +22,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; - import com.threerings.presents.net.Transport; /** @@ -41,17 +40,23 @@ public class InvocationResponseEvent extends DEvent * @param methodId the method to be invoked. * @param args the arguments for the method. This array should contain only values of valid * distributed object types. - * @param transport a hint as to the type of transport desired for the event. */ - public InvocationResponseEvent ( - int targetOid, int requestId, int methodId, Object[] args, Transport transport) + public InvocationResponseEvent (int targetOid, int requestId, int methodId, Object[] args) { - super(targetOid, transport); + super(targetOid); _requestId = (short)requestId; _methodId = (byte)methodId; _args = args; } + /** @deprecated Regenerate your services. */ + @Deprecated + public InvocationResponseEvent (int targetOid, int requestId, int methodId, Object[] args, + Transport transport) + { + this(targetOid, requestId, methodId, args); + } + /** * Returns the invocation request id associated with this response. */ diff --git a/src/main/java/com/threerings/presents/dobj/MessageEvent.java b/src/main/java/com/threerings/presents/dobj/MessageEvent.java index d553b1d3f..d118990f0 100644 --- a/src/main/java/com/threerings/presents/dobj/MessageEvent.java +++ b/src/main/java/com/threerings/presents/dobj/MessageEvent.java @@ -23,8 +23,6 @@ package com.threerings.presents.dobj; import com.samskivert.util.StringUtil; -import com.threerings.presents.net.Transport; - /** * A message event is used to dispatch a message to all subscribers of a distributed object without * actually changing any of the fields of the object. A message has a name, by which different @@ -43,11 +41,10 @@ public class MessageEvent extends NamedEvent * @param name the name of the message event. * @param args the arguments for this message. This array should contain only values of valid * distributed object types. - * @param transport a hint as to the type of transport desired for the event. */ - public MessageEvent (int targetOid, String name, Object[] args, Transport transport) + public MessageEvent (int targetOid, String name, Object[] args) { - super(targetOid, name, transport); + super(targetOid, name); _args = args; } diff --git a/src/main/java/com/threerings/presents/dobj/NamedEvent.java b/src/main/java/com/threerings/presents/dobj/NamedEvent.java index 193e5e5cd..46dc4fadf 100644 --- a/src/main/java/com/threerings/presents/dobj/NamedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/NamedEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * A common parent class for all events that are associated with a name * (in some cases a field name, in other cases just an identifying name). @@ -35,11 +33,10 @@ public abstract class NamedEvent extends DEvent * * @param targetOid the object id of the object in question. * @param name the name associated with this event. - * @param transport a hint as to the type of transport desired for the event. */ - public NamedEvent (int targetOid, String name, Transport transport) + public NamedEvent (int targetOid, String name) { - super(targetOid, transport); + super(targetOid); _name = name; } diff --git a/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java index a1c323fc9..f0c919148 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectAddedEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * An object added event is dispatched when an object is added to an OidList attribute * of a distributed object. It can also be constructed to request the addition of an oid to an @@ -42,7 +40,7 @@ public class ObjectAddedEvent extends NamedEvent */ public ObjectAddedEvent (int targetOid, String name, int oid) { - super(targetOid, name, Transport.DEFAULT); + super(targetOid, name); _oid = oid; } diff --git a/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java index 11d497fc9..ad5cf9976 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectDestroyedEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * An object destroyed event is dispatched when an object has been removed * from the distributed object system. It can also be constructed to @@ -39,7 +37,7 @@ public class ObjectDestroyedEvent extends DEvent */ public ObjectDestroyedEvent (int targetOid) { - super(targetOid, Transport.DEFAULT); + super(targetOid); } @Override diff --git a/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java b/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java index 036553985..99b27037b 100644 --- a/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ObjectRemovedEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * An object removed event is dispatched when an object is removed from an OidList * attribute of a distributed object. It can also be constructed to request the removal of an oid @@ -42,7 +40,7 @@ public class ObjectRemovedEvent extends NamedEvent */ public ObjectRemovedEvent (int targetOid, String name, int oid) { - super(targetOid, name, Transport.DEFAULT); + super(targetOid, name); _oid = oid; } diff --git a/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java b/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java index c7138e457..676e177be 100644 --- a/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ReleaseLockEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * A release lock event is dispatched at the end of a chain of events to release a lock that is * intended to prevent some application defined activity from happening until those events have @@ -44,7 +42,7 @@ public class ReleaseLockEvent extends NamedEvent */ public ReleaseLockEvent (int targetOid, String name) { - super(targetOid, name, Transport.DEFAULT); + super(targetOid, name); } @Override diff --git a/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java b/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java index 291dbcfbd..5190aa0dd 100644 --- a/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java +++ b/src/main/java/com/threerings/presents/dobj/ServerMessageEvent.java @@ -21,8 +21,6 @@ package com.threerings.presents.dobj; -import com.threerings.presents.net.Transport; - /** * A message event that only goes to the server. If generated on the server then it never leaves * the server. @@ -40,7 +38,7 @@ public class ServerMessageEvent extends MessageEvent */ public ServerMessageEvent (int targetOid, String name, Object[] args) { - super(targetOid, name, args, Transport.DEFAULT); + super(targetOid, name, args); } @Override diff --git a/src/main/java/com/threerings/presents/server/InvocationSender.java b/src/main/java/com/threerings/presents/server/InvocationSender.java index 002610ee4..f8a8d5c5d 100644 --- a/src/main/java/com/threerings/presents/server/InvocationSender.java +++ b/src/main/java/com/threerings/presents/server/InvocationSender.java @@ -63,9 +63,9 @@ public abstract class InvocationSender // "methodId", methodId, "args", args); // create and dispatch an invocation notification event - target.postEvent( - new InvocationNotificationEvent( - target.getOid(), rreg.receiverId, methodId, args, transport)); + target.postEvent(new InvocationNotificationEvent( + target.getOid(), rreg.receiverId, methodId, args). + setTransport(transport)); } } } diff --git a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java index e940fc109..a56a7fbe2 100644 --- a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -53,7 +53,6 @@ import com.threerings.presents.dobj.ObjectRemovedEvent; import com.threerings.presents.dobj.OidList; import com.threerings.presents.dobj.RootDObjectManager; import com.threerings.presents.dobj.Subscriber; -import com.threerings.presents.net.Transport; import static com.threerings.presents.Log.log; @@ -927,7 +926,7 @@ public class PresentsDObjectMgr public AccessObjectEvent (int oid, Subscriber target, int action) { - super(DUMMY_OID, Transport.DEFAULT); // target the bogus object + super(DUMMY_OID); // target the bogus object _oid = oid; _target = target; _action = action; diff --git a/src/main/resources/com/threerings/presents/tools/marshaller.tmpl b/src/main/resources/com/threerings/presents/tools/marshaller.tmpl index 1c55e56fa..9ce61bfc8 100644 --- a/src/main/resources/com/threerings/presents/tools/marshaller.tmpl +++ b/src/main/resources/com/threerings/presents/tools/marshaller.tmpl @@ -32,10 +32,7 @@ public class {{name}}Marshaller extends InvocationMarshaller // from interface {{listenerName}}Marshaller public void {{method.name}} ({{getArgList}}) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, {{code}}, - new Object[] { {{getWrappedArgList}} }, transport)); + sendResponse({{code}}, new Object[] { {{getWrappedArgList}} }); } {{/methods}} diff --git a/src/test/java/com/threerings/presents/data/TestMarshaller.java b/src/test/java/com/threerings/presents/data/TestMarshaller.java index b572cfe7d..a4f161025 100644 --- a/src/test/java/com/threerings/presents/data/TestMarshaller.java +++ b/src/test/java/com/threerings/presents/data/TestMarshaller.java @@ -53,10 +53,7 @@ public class TestMarshaller extends InvocationMarshaller // from interface TestFuncMarshaller public void testSucceeded (String arg1, int arg2) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, TEST_SUCCEEDED, - new Object[] { arg1, Integer.valueOf(arg2) }, transport)); + sendResponse(TEST_SUCCEEDED, new Object[] { arg1, Integer.valueOf(arg2) }); } @Override // from InvocationMarshaller @@ -88,10 +85,7 @@ public class TestMarshaller extends InvocationMarshaller // from interface TestOidMarshaller public void gotTestOid (int arg1) { - _invId = null; - omgr.postEvent(new InvocationResponseEvent( - callerOid, requestId, GOT_TEST_OID, - new Object[] { Integer.valueOf(arg1) }, transport)); + sendResponse(GOT_TEST_OID, new Object[] { Integer.valueOf(arg1) }); } @Override // from InvocationMarshaller