Commit Graph

161 Commits

Author SHA1 Message Date
Michael Bayne ad49401543 Proguard fucks up if we use clone(). There's no apparent way to find out why it
magically booches and causes an IncompatibleClassChangeError, so we're just
going to work around it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4008 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-04-10 20:16:44 +00:00
Ray Greenwell 333d476a4a Use array cloning rather than creating a new one and copying into it.
(It may be the same thing under the hood, but our pal Occam would approve.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3958 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-17 22:29:00 +00:00
Ray Greenwell 7336f11d6f Shrink capacity in DSets upon element removal if the capacity is 8x larger
than it needs to be.
Broke streaming compatibility in order to be much more efficient over the wire.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3938 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-03-11 02:43:32 +00:00
Ray Greenwell 5bd90aa797 Stop using TrackedObjects.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3726 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-10-11 19:17:43 +00:00
Ray Greenwell 16322b1422 Added some warnings for illegal DSet operations and added a small
optimization in the process.
Previously, we dumped stack on the server if a entry add was illegal but
did nothing for update/remove.
On the client, we complained for updates and (indirectly) adds, but not
removes.
Now we complain everywhere.
And- as an added bonus, on the server we now do only one binary search for
updates and removals. Whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3528 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-04-29 02:30:23 +00:00
Ray Greenwell ec31df7a99 Removed cruft.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3486 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-04-14 20:39:56 +00:00
Ray Greenwell be8a755dad The generic set updaters weren't working because proguard renamed the
methods they were looking for.

Since it's probably impossible to have proguard generically skip renaming
for these generated method names, let's update the fields in a different way.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3434 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-28 22:31:46 +00:00
Ray Greenwell 12b267dbae One day we hope to implement Iterable, let's implement the standard
'iterator()' name and deprecate the old 'entries()' method.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3405 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-03-15 01:40:22 +00:00
Michael Bayne aa80b920c8 More documentation updates.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3315 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-27 04:48:00 +00:00
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 7777a14c9c DSet already complains if we add a duplicate; no need to do so twice.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3293 542714f4-19e9-0310-aa3c-eee0fc999fb1
2005-01-05 06:00:37 +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 36a629c5e9 More ...Equal() -> ...() and ...() to ...Ref().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3171 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-10-23 17:36:32 +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 864adbdc20 Tracked objects. Now to set about to figuring out what to track.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3075 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-08-13 23:44:16 +00:00
Michael Bayne f700be00db Proving the value of the instant-review system, we repair this booch
before it has a chance to bring everything to a screeching halt.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3051 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-07-07 04:08:41 +00:00
Michael Bayne 212ebb1b53 As Ray pointed out, clearing the oid upon destruction causes problems, so
let's just not do it. We can accomplish our earlier goals, though with
slightly less distinction making capability, in a different way.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3050 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-07-07 03:10:24 +00:00
Michael Bayne 90e5231bae When a DObject is destroyed, set its oid to -1 so that it knows that it
was once alive but is now gone. Catch attempts to start a transaction on a
destroyed object and log them as such. Made isDestroyed() and isActive()
final for wholly unfounded performance reasons.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3045 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-07-03 07:16:56 +00:00
Ray Greenwell c8f519fc85 Rolled SettedObject right into DObject, because it's just too useful.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3019 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-06-03 18:15:03 +00:00
Ray Greenwell ae40f1ae0b SettedObject interface. We may just want to roll this into DObject.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3017 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-06-03 16:34:07 +00:00
Michael Bayne d618d3c771 Eclipse suggested cleanup.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2971 542714f4-19e9-0310-aa3c-eee0fc999fb1
2004-02-25 14:50:28 +00:00
Michael Bayne 69a973efb2 Make our object manager available to nice askers.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2903 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-12-11 18:36:32 +00:00
Michael Bayne ed5a97243e As it turns out to be nearly impossible to avoid occasionally trying to
post events to an object that is already destroyed, we'll allow
transactions to be started on non-active objects and we'll just log a
warning when the transaction is finally committed like we do for all other
events on non-active objects.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2835 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-10-25 22:08:02 +00:00
Michael Bayne 5272911863 Don't really need the stack trace.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2833 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-10-25 00:04:00 +00:00
Michael Bayne 44f2a352cc Removed vestigal business.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2811 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-09-24 21:39:42 +00:00
Michael Bayne 320f53913b We only need to introspect and sort our fields array once per class, not
every time we create a distributed object.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2810 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-09-24 20:33:06 +00:00
Michael Bayne b19fcb219b getClass().getField() creates a new Field instance every time and possibly
creates an Object[] as well. Now we cache the Field instances and look
them up ourselves which will likely be much more efficient at only a small
additional memory cost.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2805 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-09-23 17:16:46 +00:00
Michael Bayne 76af5d2353 Prevent propagation of lock release events.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2720 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-22 22:54:14 +00:00
Michael Bayne f7d55b9814 More debugging for DSet duplicate business.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2716 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-20 17:02:26 +00:00
Michael Bayne 10ceff36d2 Log up a warning in these trying circumstances so that future bugs don't
remain obscure.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2708 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-13 02:59:27 +00:00
Michael Bayne d37c56b077 Added more substantial funny business checks.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2701 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:49:52 +00:00
Ray Greenwell cfe4b49c6e Key is Comparable.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2699 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:21:43 +00:00
Ray Greenwell 71cd8b421a - Use the newer binary search method of locating entries in get().
- Require a Comparable key in get() and containsKey().


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2698 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-07-11 01:21:23 +00:00
Michael Bayne d76d4e89ff Make it possible to have a distributed object destroyed when its last
subscriber is removed.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2602 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-22 17:23:53 +00:00
Ray Greenwell c7908862ff SetAdapter, because SetListener is a pain sometimes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2592 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-20 18:41:46 +00:00
Ray Greenwell 098cb693d1 Fixed.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2516 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-01 02:11:22 +00:00
Ray Greenwell 0e8b1dd058 Removed crack pipe.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2515 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-05-01 02:05:51 +00:00
Ray Greenwell fc6d71cae1 Actually initialize the oldValue to UNSET_OLD_VALUE.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2512 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-30 22:38:49 +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 36624d96ac Finally got around to making compound events actually stick together until
they arrive at the client. Mmm... network efficiency++.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2396 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-10 17:48:42 +00:00
Michael Bayne 1b29c23f6e Check and fail if a DSet is modified while we are iterating over it.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2380 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-04-05 20:30:44 +00:00
Michael Bayne 0a5714b661 Safety first!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2354 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-30 19:38:56 +00:00
Ray Greenwell a8ca78bde2 toArray now returns Object[] instead of Object
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2327 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-26 00:16:03 +00:00
Michael Bayne b975698d02 No need for nestable exception. It's standard issue now.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2316 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-23 01:54:20 +00:00
Michael Bayne ef525ebad9 Modified DSet support such that additions, updates and removals are
applied immediately on the authoritative copy of the object (the one on
the server). We already do this for all other object modifications (except
OidList which is kind of special anyway), but we should be wary of
potential wickosity.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2302 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-03-10 18:29:54 +00:00
Michael Bayne 97c02d2a00 Don't make the internal field a Comparable as the serialization stuff
chokes on that.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2291 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-02-26 21:41:47 +00:00
Michael Bayne 56b0012782 Use Comparable for the to be removed distributed set key.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2290 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-02-26 17:54:56 +00:00
Michael Bayne 7b97f872c8 Allow initialization from an array of entries.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2285 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-02-18 19:50:34 +00:00
Michael Bayne 51a883fc34 Factored toString() into two methods for easier customization by derived
classes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2284 542714f4-19e9-0310-aa3c-eee0fc999fb1
2003-02-18 18:59:08 +00:00