Commit Graph

19 Commits

Author SHA1 Message Date
Ray Greenwell 5ba72dce1a Occam's razor.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3296 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-05 08:07:13 +00:00
Michael Bayne e5acc3e45f More DObject fun! We need to keep a careful separation for container
objects (DSet, arrays) in a DEvent (which should not change as a result of
other events being applied) and those in the object itself (which do
change and evolve as events are applied to the object).

This is important both because the DEvent is passed on to another thread
for delivery to remote clients, thus changes to the values in the event
could take place before they were serialized and sent over the network,
and because compound events are applied to an object before they are sent
to the other thread for delivery and thus, for example, setting a DSet and
then adding a few entries to it in a compound event would result in the
DEvent copy of the DSet becoming corrupted.

Two problems remain (note, neither of these are new, the one issue
introduced when I rewrote the DObject stuff is fixed by these checkins):

1. Object subscription requests are supposed to deliver a snapshot of the
   object at the point in the event stream at which the subscription
   request was processed, but presently we pass only a reference to the
   object off to the networking thread which means that before the object
   is serialized and sent to clients, subsequent events could be applied
   to it and then those events would be sent to the client as well
   resulting in funny business (probably nothing more than duplicate DSet
   entry warnings, but imagination and Chapter 17 tell us that worse
   things could happen).

2. The use of Streamable instances could result in badness. If a field in
   a Streamable is modified and the whole Streamable set() back into the
   object to broadcast the update, then further changes were made to the
   Streamable before the attribute change event was serialized and sent
   over the network, the second modifications would be reflected in the
   event triggered by the first modifications.

The first problem may be solvable (albeit inefficiently) by serializing
the DObject on the event dispatcher thread and sending that serialized
copy off to the network thread for delivery to the client. It would be
much less efficient as we would be unable to make use of the client's
already "primed" ObjectOutputStream which may have already mapped many of
the classes in the object to two byte codes, but object subscription is
fairly uncommon compared to delivery of events, so inefficiency might not
be a big problem in this case.

The second problem might be solved by requiring that all Streamable
implementations implement clone() and then cloning any Streamable
attribute just as we do an array or DSet during an attribute, array
element or DSet entry change. This would be a more significant performance
hit as well as require a review of all of our Streamable classes (to
determine if they need a custom clone() implementation), and it has up to
now not actually manifested as a problem.

In any case I'm not going to tackle either of these remedies at the moment
because I'm on vacation, dammit.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3294 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-05 06:24:11 +00:00
Michael Bayne 1d976ceaf8 Merry Christmas to the server CPUs. It occurred to me that we could
accomplish our "previous value" support in the distributed object system
without using reflection and could also avoid using reflection in the case
where we have already applied the event on the server (which is generally
the case on the server).

Rather than hacking up the gendobj script, I took this opportunity also to
rewrite the DObject generation script as an Ant task and in doing so,
implemented another recent idea which is that we can just augment the
FooObject.java file instead of having a separate .dobj and .java file.

You'd think it was spring there's so much cleaning going on.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3284 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-12-28 03:48:07 +00:00
Michael Bayne a9720fd905 LGPLed the library. Hello world.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3099 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-27 02:21:06 +00:00
Michael Bayne 43edd884c0 Added the necessary machinations to make getOldValue() and getOldEntry()
work on the server.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2510 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-30 22:32:04 +00:00
Michael Bayne ee9049fe3e Factored out code for events that all shared a name; removed
hand-serialization code for fields which are now handled automatically.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2078 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-12-20 23:29:04 +00:00
Michael Bayne 76ba2840c4 Provide access to the values that existed previous to the application of
events that change values.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1837 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-10-27 01:33:43 +00:00
Michael Bayne c3191b9170 Brought code into line with the new streaming world order.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1606 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-07-23 05:52:49 +00:00
Michael Bayne b7913ceb0b Moved generic marshalling code into presents.io from presents.dobj.io as
it is now general purpose.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@912 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-02-01 23:32:37 +00:00
Michael Bayne 804505890f We love to revamp! Created a set of listener interfaces which are used
with distributed objects rather than having a single handleEvent() by
which all subscribers are forced to hear about all events. Now one
subscribes separately and then adds onesself as any of a few types of
listener once they have access to the subscribed object reference.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@439 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-12 00:03:03 +00:00
Michael Bayne 8a4c46badc The first great Three Rings renaming. Cocktail changed to Narya, Cher
changed to Presents and Party changed to Crowd. Whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@431 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-10-11 04:07:54 +00:00
Michael Bayne a831089362 Revamped toString() to be more derived class friendly. Added a
ReleaseLockEvent which will be used by the distributed object locking
facilities.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@169 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-04 00:32:11 +00:00
Michael Bayne 9d93650b65 Fixed javadoc @see syntax.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@143 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-02 04:49:08 +00:00
Michael Bayne 55a648dcf9 These need zero argument constructors to allow for unserialization.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@36 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-13 05:15:49 +00:00
Michael Bayne c8b13e3bca Documented valid dobj types in DObject; implemented value marshaller which
can read and write all of the valid dobj types over the network; wired up
the attribute changed events to serialize and unserialize their values.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@35 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-12 02:57:30 +00:00
Michael Bayne 89083f4708 Moved the typed object registry into the same package with the rest of
the typed object stuff; made events typed so they can be transported;
further wiring up of event dispatch over the network.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@34 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-11 17:44:04 +00:00
Michael Bayne 1929898dd8 More juicy goodness. Event dispatch seems to work now.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@20 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-01 20:35:39 +00:00
Michael Bayne 45c2dc143f More progress on the distributed object stuff.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@19 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-01 19:56:13 +00:00
Michael Bayne 825b36c0ff Beginnings of event stuff.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@18 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-01 07:12:13 +00:00