Commit Graph

6048 Commits

Author SHA1 Message Date
Ray Greenwell 0771006ab0 Expand these tests for maps, sets, collections.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6119 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 23:38:25 +00:00
Ray Greenwell ee1d915e91 List streams differently now.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6118 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 23:20:39 +00:00
Ray Greenwell 2f039b370d Changed this, as List is streamed differently now that the bug with it is fixed.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6117 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 23:20:03 +00:00
Ray Greenwell 931d72f4b5 Streaming changes.
- Fix the bug with streaming an object that had a field typed as merely 'List'.
  This will result in an incompatible change. Notably, BootstrapData has a List
  field, but this shouldn't be accessed until after versions are checked.
  The bug also meant that such fields could only hold an ArrayList. Now they
  may hold any List type and will turn into an ArrayList on the other end...
- Support Map and Set streaming in the same way.
- Support using unmodifiedUTF if the "com.threerings.io.unmodifiedUTFStreaming"
  system property is set to the String "true".

We can roll this back if it freaks something out, but I'd rather push forward.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6116 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 23:18:02 +00:00
Michael Bayne 5c7d59e597 This is so succinct now, we can dispense with the helper method altogether.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6115 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 22:09:33 +00:00
Michael Bayne 83c5fcfb15 Whoa, Daddy-O! This is almost like a real abstraction in Java.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6114 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 22:07:48 +00:00
Michael Bayne 89dfe715d8 Switch class to streamer mapping to a Map. Whoa! I used a linked hash map to
preserve the registration order, in case that's significant. It would be nice
if Guava had an ImmutableLinkedHashMap, but I don't see such a thing.

Thanks to my newly added unit tests, I'm pretty confident that I didn't just
fuck something up. Woo.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6113 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 22:04:05 +00:00
Michael Bayne 41ba838b20 More supported types, and a less heinously formatted blob.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6112 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 21:46:59 +00:00
Michael Bayne 7967925920 More types!
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6111 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 21:30:05 +00:00
Michael Bayne 589b2128e3 Made StreamableTest actually test something. Specifically:
- expanded Widget to contain all of the generally supported streamable types
  (if I missed any, please add them);

- added proper equals() methods and tests to ensure that writing an object and
  reading it back yield an object that equals() the original;

- added a binary blob containing the over-the-wire bits for said comprehensive
  object; test that serializing an instance yields those bits and test that
  unserializing those bits yields a proper object; this will catch future
  situations where we inadvertently change the wire format for a type via
  subtle changes to the streaming code;

- updated things to JUnit 4 style.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6110 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 21:24:26 +00:00
Charlie Groves 4ea22628f7 Generalize velocity creation and classloader setting for code generation ant tasks into GenTask
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6109 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-10 00:38:46 +00:00
Charlie Groves 1236121ff6 Add names to the builtin FieldMarshallers to make them differentiable when printed
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6108 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-09 22:23:32 +00:00
Ray Greenwell decb56970c Use the Maps builder method.
Assign the DEFAULT_MAP if we unstream an empty map, too.
Comment DEFAULT_MAP.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6107 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-09 18:37:54 +00:00
Nathan Curtis e3ae54ddb4 Add a comment so people don't accidentally new StreamableHashMap(), and expect it to work.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6106 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-09 18:34:26 +00:00
Nathan Curtis b6174f659f If no map class is passed in (should only happen on deserialization, and the real source map is provided on readObject), pass an empty immutable map to super, which is less weird and probably better than just ignoring and forcibly not calling the super constructor, which is what was happening.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6105 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-09 18:30:45 +00:00
Charlie Groves 4e8c8bce3c Comment fixes. Object[] is put in _marshallers as a wrapped BasicStreamer below, so don't act like
we're handling it with the generic marshaller.



git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6104 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-08 22:19:17 +00:00
Bruno Garcia 00a5e66f92 Style.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6103 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-08-03 02:48:42 +00:00
Bruno Garcia 03ae523e62 Typo.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6102 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-29 20:35:45 +00:00
Ray Greenwell 7b86f2d8db Prefer StringBuilder where possible.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6101 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-22 01:20:02 +00:00
Andrzej Kapolka 1bfc69aa49 Seems byte was only partially added here.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6100 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-20 01:11:55 +00:00
Ray Greenwell 73900f891d Oh dear, fix already used variable name.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6099 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-19 18:08:54 +00:00
Ray Greenwell 353fdcd7cf I'm trying to excise uses of com.samskivert.util.Collections, which is
full of some weird old stuff, much of it replaced by using Guava or newer
1.5 features.

Instead of using a "sorted iterator", slap the elements in a TreeSet.
Insertions are O(log n), and sorting an ArrayList would be O(n log n),
so it should be pretty much the same (TreeSet probably uses more memory).

Comments welcome.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6098 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-19 17:53:59 +00:00
Ray Greenwell 126ee1f738 Guavafication. A little ugly.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6097 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-16 01:19:36 +00:00
Dave Hoover dc11108af4 Some tweaks to getTimeString.
First & easiest, no longer include zeros in our built-up string. It used to
say things like "3 days, 0 hours, 2 minutes, 0 seconds" if your minUnit was
seconds. Now we'll just tell you it's 3 days & 2 minutes.

Second, it used to (and still does, if you use the old-signature wrapper)
round DOWN to the nearest minUnit.

For example, 59 minutes, shown with minUnit of hours, would claim to be
0 hours. For some things (e.g. showing time remaining on a subscription), that
kind of pessimistic display is the safe approach. For other things
(e.g. come back in 0 hours and your temp ban is over), we'd rather err on the
side of saying TOO much time (e.g. telling someone their suspension will be
over in 2 hours when they really only need to wait 61 minutes)

There's other rework that I'm itching to do in this stuff, but no, let's just
give ourselves an option on this particular thing so we can clean up one thing
in yohoho and be done with it for now.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6096 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-14 20:59:02 +00:00
Ray Greenwell 6bff220be7 Prefer java standard libraries, then guava, then samskivert.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6095 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-14 19:28:14 +00:00
Dave Hoover cdebcfa71d StringUtil.replace is deprecated
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6094 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-13 21:45:39 +00:00
Dave Hoover 3340e270ae Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6093 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-13 21:45:38 +00:00
Dave Hoover b8e029fdad In with the new logging
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6092 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-09 23:33:38 +00:00
Par Winzell 46835601af Missing newline in report.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6091 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-02 13:32:49 +00:00
Mike Thomas 4ddc60e369 Integer was getting envious of Short's MIN/MAX_VALUE constants, so let's appease it.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6090 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-07-01 20:17:52 +00:00
Mike Thomas 2f704712b2 I am of two minds whether this is the "right" way or not, but Eclipse's warnings sure think so. Since the generics portion has been erased we can only check against <?> but we at least are noting that it's a parameterized type.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6089 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-28 17:19:41 +00:00
Par Winzell bf34448cdb Grumble, allow Java5 its stingy @Override semantics.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6088 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-23 21:47:52 +00:00
Par Winzell b6228a0dfe There was already existing support for executing a NodeAction on all peers; this extends such support to NodeRequests, which have the additional property of taking a Listener, and thus being able to wait for the request to finish. For multiple peers, the requests are processed in parallel. If all the requests finish executing without error, the function reports success. If at least one node reports failure, so does the function.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6087 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-23 21:29:02 +00:00
Par Winzell 6971ce7d4d There's no reason to demand an IntSet here.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6086 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-22 15:19:59 +00:00
Charlie Groves 12578d8810 Gotta be symmetric with readField
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6085 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-22 03:16:23 +00:00
Charlie Groves 2268aae388 Handle primitive arrays
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6084 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-22 03:04:53 +00:00
Dave Hoover 3b266edcd6 That should be private.
If it's public, we try to shadow it in a subclass & wind up still
getting THIS one.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6083 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-18 23:40:16 +00:00
Dave Hoover c54c82da55 Slay some cyclopian variables.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6082 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-15 17:26:29 +00:00
Dave Hoover 9b1624ced6 Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6081 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-15 17:26:27 +00:00
Dave Hoover 0583a92100 Speeling
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6080 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-15 17:26:26 +00:00
Michael Bayne 5a02c42c21 Use our standard loop idioms.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6079 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-14 23:30:47 +00:00
Andrzej Kapolka 129023182c Remove WeakListenerWrapper in favor of simply storing the WeakReference
directly in the array.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6078 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-14 20:12:16 +00:00
Andrzej Kapolka 06a7d265a7 Simplify the API by using a parameter to control whether we retain a weak or
strong reference to the listener.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6077 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-13 02:36:16 +00:00
Andrzej Kapolka 852c66497e Allow adding/removing listeners by weak reference so as not to prevent
garbage collection.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6076 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-12 01:15:22 +00:00
Dave Hoover b072941003 Whitespace
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6075 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-11 22:57:20 +00:00
Dave Hoover 1f292a5184 Fix syntax
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6074 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-11 22:57:19 +00:00
Ray Greenwell 22d586dc89 Use aspirin.swc.
Removed corelib and ooolib (aspirin) from our included libraries.
That ain't right. But they were also in the external libraries
and that seems to have been what was happening.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6073 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-09 20:47:49 +00:00
Andrzej Kapolka d7e5d3cf85 Broke out the places where we actually read from/write to the channels into
separate methods so that we can override them to do crazy stuff like simulate
latency/dropped packets for debugging.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6072 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-09 03:27:27 +00:00
Mike Thomas 079269a825 Handle short[]'s on the actionscript side of streaming. This gets a little ugly given the lack of a primitive short on the actionscript side...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6071 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-08 01:37:08 +00:00
Mike Thomas 7101012413 A new type of general communication between peers - the NodeRequest - it's a lot like a NodeAction but produces a result which is sent back via the ResultListener.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6070 542714f4-19e9-0310-aa3c-eee0fc999fb1
2010-06-01 23:48:50 +00:00